def METHOD_NAME(o):
    def _string_base64(s):
        if isinstance(s, Base64String):
            return base64.b64encode(str(s).encode('utf-8')).decode('utf-8')
        raise TypeError
    return json.dumps(o, default=_string_base64, sort_keys=True)