I would pull this out of the XBlock class (either into this file, or into the `xblock.exceptions` package).