code: def format_delta(__timedelta: datetime.timedelta) -> str:
      
      if __timedelta == datetime.timedelta(0):
          return ''
      days_s = '{}D'.format(__timedelta.days) if __timedelta.days else ''
      hours, minutes = divmod(__timedelta.seconds, 3600)
      minutes, seconds = divmod(minutes, 60)
      hours_s = '{:02d}H'.format(hours) if hours else ''
      minutes_s = '{:02d}M'.format(minutes) if minutes else ''
      seconds_s = '{:02d}S'.format(seconds) if seconds else ''
      return 'P{}{}{}{}{}'.format(days_s,
                                  'T' if hours or minutes or seconds else '',
                                  hours_s, minutes_s, seconds_s)
docs: Format ISO-8601 duration string.
  
      Args:
          __timedelta: Duration to process
      Returns:
          ISO-8601 representation of duration