def datetime_normalizer(self, value):
if (<EOL>isinstance(value, datetime.date)<EOL>and not isinstance(value, datetime.datetime)<EOL>):<EOL><INDENT>value_full = datetime.datetime.combine(value, datetime.time.min)<EOL>localized = local_zone.localize(value_full)<EOL><DEDENT>elif isinstance(value, datetime.datetime):<EOL><INDENT>if value.tzinfo is None:<EOL><INDENT>localized = local_zone.localize(value)<EOL><DEDENT>else:<EOL><INDENT>localized = value<EOL><DEDENT><DEDENT>elif isinstance(value, six.string_types):<EOL><INDENT>localized = self.backend.convert_datetime_string(value)<EOL><DEDENT>else:<EOL><INDENT>raise ValueError("<STR_LIT>"<EOL>"<STR_LIT>"<EOL>.format(type(value)))<EOL><DEDENT>return localized<EOL>
Normalizes date/datetime value (considered to come from user input)
to localized datetime value. Following conversions happen:

naive date -> localized datetime with the same date, and time=midnight
naive datetime -> localized datetime with the same value
localized datetime -> localized datetime (no conversion)