def format_delta(td: float) -> str:
    """
    Format a time delta in a human readable format.
    """
    if abs(td) < 60.0:
        return "%.6f seconds" % td

    if abs(td) < 60*60:
        m, r = divmod(td, 60)
        s = r

        return "%i minutes %i seconds" % (m, s)

    elif abs(td) < 60*60*24:
        h, r = divmod(td, 60*60)
        m, r = divmod(r, 60)
        s = r

        return "%i hours %i minutes %i seconds" % (h, m, s)

    else:
        d, r = divmod(td, 60*60*24)
        h, r = divmod(r, 60*60)
        m, r = divmod(r, 60)
        s = r

        return "%i days %i hours %i minutes %i seconds" % (d, h, m, s)