docs: def _airflow_macro_formats(date_time, macros, types_and_values):
      """ Return a mapping from airflow macro names (prefixed with '_') to values
  
      Args:
        date_time: The timestamp at which the macro values need to be evaluated. This is only
            applicable when types_and_values = True
        macros: If true, the items in the returned dict are the macro strings (like '_ds': '{{ ds }}')
        types_and_values: If true, the values in the returned dict are dictionaries of the types and
            the values of the parameters (i.e like '_ds': {'type': STRING, 'value': 2017-12-21})
      Returns:
        The resolved value, i.e. the value with the format modifiers replaced with the corresponding
            parameter-values. E.g. if value is <project-id>.<dataset-id>.logs_%(_ds)s, the returned
            value could be <project-id>.<dataset-id>.logs_2017-12-21.
      """
      day = date_time.date()
      airflow_macros = {
        # the datetime formatted as YYYY-MM-DD
        '_ds': {'type': 'STRING', 'value': day.isoformat(), 'macro': '{{ ds }}'},
        # the full ISO-formatted timestamp YYYY-MM-DDTHH:MM:SS.mmmmmm
        '_ts': {'type': 'STRING', 'value': date_time.isoformat(), 'macro': '{{ ts }}'},
        # the datetime formatted as YYYYMMDD (i.e. YYYY-MM-DD with 'no dashes')
        '_ds_nodash': {'type': 'STRING', 'value': day.strftime('%Y%m%d'),
                       'macro': '{{ ds_nodash }}'},
        # the timestamp formatted as YYYYMMDDTHHMMSSmmmmmm (i.e full ISO-formatted timestamp
        # YYYY-MM-DDTHH:MM:SS.mmmmmm with no dashes or colons).
        '_ts_nodash': {'type': 'STRING', 'value': date_time.strftime('%Y%m%d%H%M%S%f'),
                       'macro': '{{ ts_nodash }}'},
        '_ts_year': {'type': 'STRING', 'value': day.strftime('%Y'),
                     'macro': """{{ '{:04d}'.format(execution_date.year) }}"""},
        '_ts_month': {'type': 'STRING', 'value': day.strftime('%m'),
                      'macro': """{{ '{:02d}'.format(execution_date.month) }}"""},
        '_ts_day': {'type': 'STRING', 'value': day.strftime('%d'),
                    'macro': """{{ '{:02d}'.format(execution_date.day) }}"""},
        '_ts_hour': {'type': 'STRING', 'value': date_time.strftime('%H'),
                     'macro': """{{ '{:02d}'.format(execution_date.hour) }}"""},
        '_ts_minute': {'type': 'STRING', 'value': date_time.strftime('%M'),
                       'macro': """{{ '{:02d}'.format(execution_date.minute) }}"""},
        '_ts_second': {'type': 'STRING', 'value': date_time.strftime('%S'),
                       'macro': """{{ '{:02d}'.format(execution_date.second) }}"""},
      }
  
      if macros:
        return {key: value['macro'] for key, value in airflow_macros.items()}
  
      if types_and_values:
        return {
          key: {
            'type': item['type'],
            'value': item['value']
          } for key, item in airflow_macros.items()
        }
  
      # By default only return values
      return {key: value['value'] for key, value in airflow_macros.items()}