Converts seconds remaining into a human readable timestamp (e.g. hh:mm:ss, h:mm:ss, mm:ss, or ss).

    Positional arguments:
    seconds -- integer/float indicating seconds remaining.

    Keyword arguments:
    always_show_hours -- don't hide the 0 hours.
    always_show_minutes -- don't hide the 0 minutes.
    hours_leading_zero -- show 01:00:00 instead of 1:00:00.

    Returns:
    Human readable string.

def eta_hms(seconds, always_show_hours=False, always_show_minutes=False, hours_leading_zero=False):
    """Converts seconds remaining into a human readable timestamp (e.g. hh:mm:ss, h:mm:ss, mm:ss, or ss).

    Positional arguments:
    seconds -- integer/float indicating seconds remaining.

    Keyword arguments:
    always_show_hours -- don't hide the 0 hours.
    always_show_minutes -- don't hide the 0 minutes.
    hours_leading_zero -- show 01:00:00 instead of 1:00:00.

    Returns:
    Human readable string.
    """
    # Convert seconds to other units.
    final_hours, final_minutes, final_seconds = 0, 0, seconds
    if final_seconds >= 3600:
        final_hours = int(final_seconds / 3600.0)
        final_seconds -= final_hours * 3600
    if final_seconds >= 60:
        final_minutes = int(final_seconds / 60.0)
        final_seconds -= final_minutes * 60
    final_seconds = int(ceil(final_seconds))

    # Determine which string template to use.
    if final_hours or always_show_hours:
        if hours_leading_zero:
            template = '{hour:02.0f}:{minute:02.0f}:{second:02.0f}'
        else:
            template = '{hour}:{minute:02.0f}:{second:02.0f}'
    elif final_minutes or always_show_minutes:
        template = '{minute:02.0f}:{second:02.0f}'
    else:
        template = '{second:02.0f}'

    return template.format(hour=final_hours, minute=final_minutes, second=final_seconds)