def AdManagerDateTimePacker(cls, value, version):
    """Returns dicts formatted for Ad Manager SOAP based on date/datetime.

    Args:
      value: A date or datetime object to be converted.
      version: the version of the current API, e.g. 'v201811'

    Returns:
      The value object correctly represented for Ad Manager SOAP.
    """

    if isinstance(value, datetime.datetime):
      if value.tzinfo is None:
        raise googleads.errors.GoogleAdsValueError(
            'Datetime %s is not timezone aware.' % value
        )
      return {
          'date': cls.AdManagerDateTimePacker(value.date(), version),
          'hour': value.hour,
          'minute': value.minute,
          'second': value.second,
          # As of V201811, timeZoneID was renamed timeZoneId
          'timeZoneId' if version >= 'v201811' else 'timeZoneID':
              value.tzinfo.zone,
      }
    elif isinstance(value, datetime.date):
      return {'year': value.year, 'month': value.month, 'day': value.day}