def bind_processor(self, dialect):
    datetime_datetime = datetime.datetime
    datetime_date = datetime.date
    format_ = self._storage_format

    def process(value):
        if (value is None):
            return None
        elif isinstance(value, datetime_datetime):
            return (format_ % {'year': value.year, 'month': value.month, 'day': value.day, 'hour': value.hour, 'minute': value.minute, 'second': value.second, 'microsecond': value.microsecond})
        elif isinstance(value, datetime_date):
            return (format_ % {'year': value.year, 'month': value.month, 'day': value.day, 'hour': 0, 'minute': 0, 'second': 0, 'microsecond': 0})
        else:
            raise TypeError('SQLite DateTime type only accepts Python datetime and date objects as input.')
    return process
def bind_processor(self, dialect):
    datetime_datetime = datetime.datetime
    datetime_date = datetime.date
    format_ = self._storage_format

    def process(value):
        if (value is None):
            return None
        elif isinstance(value, datetime_datetime):
            return (format_ % {'year': value.year, 'month': value.month, 'day': value.day, 'hour': value.hour, 'minute': value.minute, 'second': value.second, 'microsecond': value.microsecond})
        elif isinstance(value, datetime_date):
            return (format_ % {'year': value.year, 'month': value.month, 'day': value.day, 'hour': 0, 'minute': 0, 'second': 0, 'microsecond': 0})
        else:
            raise TypeError('SQLite DateTime type only accepts Python datetime and date objects as input.')
    return process