code: def timedelta2period(duration):
      
      seconds = duration.seconds
      minutes = (seconds % 3600) // 60
      seconds = (seconds % 60)
      return '{0:0>2}:{1:0>2}'.format(minutes, seconds)
docs: Convert timedelta to different formats.