def METHOD_NAME(self, obj):
    format_spec = self.FORMAT_SPEC
    json_repr = super(MyEncoder, self).METHOD_NAME(obj) 
    for match in self.regex.finditer(json_repr):
        id = int(match.group(1))
        no_indent = PyObj_FromPtr(id)
        json_obj_repr = json.dumps(no_indent.value, sort_keys=self.__sort_keys)
        json_repr = json_repr.replace(
                        '"{}"'.format(format_spec.format(id)), json_obj_repr)
    return json_repr