def DatetimeValueToString(value):
  if isinstance(value, datetime.time):
    return value.strftime(TIME_STRING_FORMAT)
  # Order is important, datetime.datetime is a subclass of datetime.date
  elif isinstance(value, datetime.datetime):
    return value.strftime(DATETIME_STRING_FORMAT)
  elif isinstance(value, datetime.date):
    return value.strftime(DATE_STRING_FORMAT)
  else:
    raise TypeError('Could not serialize timestamp: %s.' % (value,))
For each field in field_names, attach language-specific mappings that
dataset/ETHPy150Open GoogleCloudPlatform/endpoints-proto-datastore/endpoints_proto_datastore/utils.py/DatetimeValueToString--crossover with--dataset/ETHPy150Open mozilla/addons-server/src/olympia/amo/indexers.py/BaseSearchIndexer.attach_language_specific_analyzers