Beware that if you run python with the -O flag, it doesn't execute assert statements. I assume that edX doesn't use that flag, but especially since this is in a reusable module and there isn't any way to control what flags get used, it's risky to rely on assert to avoid bad data or enforce anything like a security constraint.
as per: https://github.com/appsembler/xblock-grade-fetcher/pull/8#discussion_r818666491