code: def format_datetime(d: PotentialDatetimeType,
                      fmt: str,
                      default: str = None) -> Optional[str]:
      
      d = coerce_to_pendulum(d)
      if d is None:
          return default
      return d.strftime(fmt)
docs: Format a datetime with a ``strftime`` format specification string, or
      return ``default`` if the input is ``None``.