def convert_duration(milliseconds):
    """
    Convert milliseconds to a timestamp
    Format: HH:MM:SS
    """
    # it's easier to wrap your head around seconds
    seconds = milliseconds / 1000

    hrs = seconds // 3600
    mins = (seconds % 3600) // 60
    s = (seconds % 3600) % 60

    return "{:02}:{:02}:{:02}".format(int(hrs), int(mins), int(s))