def dump(self, document, indent=False, **kwargs):
        if indent:
            options = {
                'ensure_ascii': False,
                'indent': 4,
                'separators': VERBOSE_SEPARATORS
            }
        else:
            options = {
                'ensure_ascii': False,
                'indent': None,
                'separators': COMPACT_SEPARATORS
            }

        data = _document_to_primative(document)
        return force_bytes(json.dumps(data, **options))
Takes a document and returns a bytestring.
dataset/ETHPy150Open core-api/python-client/coreapi/codecs/corejson.py/CoreJSONCodec.dump