def readable_time(delta_seconds):
    """Returns a human-readable string for delta seconds.
    """
    hours, remainder = divmod(int(delta_seconds), 3600)
    minutes, seconds = divmod(remainder, 60)
    days, hours = divmod(hours, 24)

    if days:
        fmt = '{d}d {h}hr {m}min {s}sec'
    elif hours:
        fmt = '{h}hr {m}min {s}sec'
    else:
        fmt = '{m}min {s}sec'

    return fmt.format(d=days, h=hours, m=minutes, s=seconds)