@classmethod<EOL><INDENT>def _serialize(cls, obj):<DEDENT>
if hasattr(obj, '<STR_LIT>'):<EOL><INDENT>if callable(obj.json):<EOL><INDENT>return json.loads(obj.json())<EOL><DEDENT>else:<EOL><INDENT>return json.loads(obj.json)<EOL><DEDENT><DEDENT>elif isinstance(obj, datetime):<EOL><INDENT>return obj.date().strftime(<EOL>DATE_FMT) + '<STR_LIT:U+0020>' + obj.time().isoformat()<EOL><DEDENT>elif isinstance(obj, date):<EOL><INDENT>return obj.strftime(ISO_DATE_FMT)<EOL><DEDENT>elif isinstance(obj, time):<EOL><INDENT>return obj.isoformat()<EOL><DEDENT>elif isinstance(obj, Decimal):<EOL><INDENT>return str(obj)<EOL><DEDENT>else:<EOL><INDENT>raise TypeError("<STR_LIT>" % type(obj))<EOL><DEDENT>
Private method to handle custom encoding for objects like `datetime`
            `Decimal`, etc
            :return: string representation of JSON data
            :raise TypeError: if JSON is not serializable