def fmt_time(value):
    """
    < 60 seconds -> displayed in seconds (limit the decimal digits to 1 or keep int)
    < 3600 seconds -> display as X m Y s (if float, trim decimal digits)
    >= 3600 seconds -> display as X h Y m Z s (if float, trim decimal digits)
    :param value: seconds or None
    :return: Formatted value
    """
    if value is None:
        return "N/A"

    if not isinstance(value, int) and not isinstance(value, float):
        raise TypeError(f"Expected int or float, got {type(value)}")

    if 0 < value < 0.1:
        return f"{value:.3f} s"
    elif value < 60:
        if isinstance(value, int):
            return f"{value} s"
        else:
            return f"{value:.1f} s"
    elif value < 3600:
        return f"{value//60:.0f} m {value%60:.0f} s"
    else:
        return f"{value//3600:.0f} h {(value%3600)//60:.0f} m {value%60:.0f} s"