import time


def time_format(sec):
    """Returns time string in readable format."""
    days = int(sec // 86400)
    time_ = time.strftime("%H:%M:%S", time.gmtime(sec % 86400))
    prefix = "%d days, " % days
    if days == 0:
        prefix = ''
    elif str(days).endswith("1"):
        if days != 11:
            prefix = "{} day, ".format(days)
    return "{}{}".format(prefix, time_)