def seconds_to_time(seconds):
    """Return a nicely formatted time given the number of seconds."""
    m, s = divmod(seconds, 60)
    h, m = divmod(m, 60)
    d, h = divmod(h, 24)
    return "%d days, %02d hours, %02d minutes, %02d seconds" % (d, h, m, s)