docs: def timestr_to_seconds(
      x: Union[dt.date, str], *, inverse: bool = False, mod24: bool = False
  ) -> int:
      """
      Given an HH:MM:SS time string ``x``, return the number of seconds
      past midnight that it represents.
      In keeping with GTFS standards, the hours entry may be greater than
      23.
      If ``mod24``, then return the number of seconds modulo ``24*3600``.
      If ``inverse``, then do the inverse operation.
      In this case, if ``mod24`` also, then first take the number of
      seconds modulo ``24*3600``.
      """
      if not inverse:
          try:
              hours, mins, seconds = x.split(":")
              result = int(hours) * 3600 + int(mins) * 60 + int(seconds)
              if mod24:
                  result %= 24 * 3600
          except:
              result = np.nan
      else:
          try:
              seconds = int(x)
              if mod24:
                  seconds %= 24 * 3600
              hours, remainder = divmod(seconds, 3600)
              mins, secs = divmod(remainder, 60)
              result = f"{hours:02d}:{mins:02d}:{secs:02d}"
          except:
              result = np.nan
      return result