def pretty_print_time(sec):
    """Get duration as a human-readable string.

    Examples:

        - 10.044 => '10.04 s'
        - 0.13244 => '132.4 ms'
        - 0.0000013244 => '1.324 us'

    Args:
        sec (float): duration in fractional seconds scale

    Returns:
        str: human-readable string representation as shown above.
    """
    for unit in ("s", "ms", "us"):
        if sec >= 500:
            return "{:.0f} {}".format(sec, unit)
        if sec >= 100:
            return "{:.1f} {}".format(sec, unit)
        if sec >= 10:
            return "{:.2f} {}".format(sec, unit)
        if sec >= 1:
            return "{:.3f} {}".format(sec, unit)
        sec *= 1000

    return "{} ns".format(int(sec))