def get_formatted_duration(seconds: float, format: str="hms") -> str:
    """Format a time in seconds.
    :param format: "hms" for hours mins secs or "ms" for min secs.
    """
    mins, secs = divmod(seconds, 60)
    if format == "ms":
        t = "{:d}m:{:02d}s".format(int(mins), int(secs))
    elif format == "hms":
        h, mins = divmod(mins, 60)
        t = "{:d}h:{:02d}m:{:02d}s".format(int(h), int(mins), int(secs))
    else:
        raise Exception("Format {} not available, only 'hms' or 'ms'".format(format))
    return t