Handles the adapting of special types from mongo

def default(self, obj, **kwargs):
        """Handles the adapting of special types from mongo"""
        if isinstance(obj, datetime.datetime):
            return time.mktime(obj.timetuple())

        if isinstance(obj, Timestamp):
            return obj.time

        if isinstance(obj, ObjectId):
            return obj.__str__()

        return JSONEncoder.default(self, obj)