# Path: pydal/_compat.py
# PY2 = sys.version_info[0] == 2
#     def implements_bool(cls):
#     def implements_iterator(cls):
#     def to_bytes(obj, charset="utf-8", errors="strict"):
#     def to_native(obj, charset="utf8", errors="strict"):
#     def to_bytes(obj, charset="utf-8", errors="strict"):
#     def to_native(obj, charset="utf8", errors="strict"):
# def with_metaclass(meta, *bases):
#         def __new__(cls, name, this_bases, d):
# def to_unicode(obj, charset="utf-8", errors="strict"):
#     class metaclass(meta):


import datetime
import decimal
import json as jsonlib
from .._compat import PY2, integer_types
            from yaml import dump

long = integer_types[-1]


class Serializers(object):
    _custom_ = {}

    def _json_parse(self, o):
        if hasattr(o, "custom_json") and callable(o.custom_json):
            return o.custom_json()
        if isinstance(o, (datetime.date, datetime.datetime, datetime.time)):
            return o.isoformat()[:19].replace("T", " ")
        elif isinstance(o, long):
            return int(o)
        elif isinstance(o, decimal.Decimal):
            return str(o)
        elif isinstance(o, set):
            return list(o)
        elif hasattr(o, "as_list") and callable(o.as_list):

# Path: pydal/_compat.py
# PY2 = sys.version_info[0] == 2
#     def implements_bool(cls):
#     def implements_iterator(cls):
#     def to_bytes(obj, charset="utf-8", errors="strict"):
#     def to_native(obj, charset="utf8", errors="strict"):
#     def to_bytes(obj, charset="utf-8", errors="strict"):
#     def to_native(obj, charset="utf8", errors="strict"):
# def with_metaclass(meta, *bases):
#         def __new__(cls, name, this_bases, d):
# def to_unicode(obj, charset="utf-8", errors="strict"):
#     class metaclass(meta):


# Path: pydal/helpers/serializers.py
import datetime
import decimal
import json as jsonlib
from .._compat import PY2, integer_types
            from yaml import dump


long = integer_types[-1]


class Serializers(object):
    _custom_ = {}

    def _json_parse(self, o):
        if hasattr(o, "custom_json") and callable(o.custom_json):
            return o.custom_json()
        if isinstance(o, (datetime.date, datetime.datetime, datetime.time)):
            return o.isoformat()[:19].replace("T", " ")
        elif isinstance(o, long):
            return int(o)
        elif isinstance(o, decimal.Decimal):
            return str(o)
        elif isinstance(o, set):
            return list(o)
        elif hasattr(o, "as_list") and callable(o.as_list):

            return o.as_list()