docs: def _date(val, offset=None):
    """ A special pseudo-type for pipeline arguments.
  
    This allows us to parse dates as Python datetimes, including special values like 'now'
    and 'today', as well as apply offsets to the datetime.
  
    Args:
      val: a string containing the value for the datetime. This can be 'now', 'today' (midnight at
          start of day), 'yesterday' (midnight at start of yesterday), or a formatted date that
          will be passed to the datetime constructor. Note that 'now' etc are assumed to
          be in UTC.
      offset: for date arguments a string containing a comma-separated list of
        relative offsets to apply of the form <n><u> where <n> is an integer and
        <u> is a single character unit (d=day, m=month, y=year, h=hour, m=minute).
  
    Returns:
      A Python datetime resulting from starting at <val> and applying the sequence of deltas
      specified in <offset>.
    """
    if val is None:
      return val
    if val == '' or val == 'now':
      when = datetime.datetime.utcnow()
    elif val == 'today':
      dt = datetime.datetime.utcnow()
      when = datetime.datetime(dt.year, dt.month, dt.day)
    elif val == 'yesterday':
      dt = datetime.datetime.utcnow() - datetime.timedelta(1)
      when = datetime.datetime(dt.year, dt.month, dt.day)
    else:
      when = datetime.datetime.strptime(val, "%Y%m%d")
    if offset is not None:
      for part in offset.split(','):
        unit = part[-1]
        quantity = int(part[:-1])
        # We can use timedelta for days and under, but not for years and months
        if unit == 'y':
          when = datetime.datetime(year=when.year + quantity, month=when.month, day=when.day,
                                   hour=when.hour, minute=when.minute)
        elif unit == 'm':
          new_year = when.year
          new_month = when.month + quantity
          if new_month < 1:
            new_month = -new_month
            new_year += 1 + (new_month // 12)
            new_month = 12 - new_month % 12
          elif new_month > 12:
            new_year += (new_month - 1) // 12
            new_month = 1 + (new_month - 1) % 12
          when = datetime.datetime(year=new_year, month=new_month, day=when.day,
                                   hour=when.hour, minute=when.minute)
        elif unit == 'd':
          when += datetime.timedelta(days=quantity)
        elif unit == 'h':
          when += datetime.timedelta(hours=quantity)
        elif unit == 'M':
          when += datetime.timedelta(minutes=quantity)
  
    return when