Convert timedelta to different formats.

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