def fmt_bytes(value):
    """
    < 1024 -> display as X B
    < 1024**2 -> display as X kB with one decimal digit
    < 1024**3 -> display as X MB with one decimal digit
    etc.
    :param value: bytes
    :return: formatted human readable value
    """
    if value is None:
        return "N/A"

    for unit in ['B', 'kB', 'MB', 'GB', 'TB']:
        if value < 1024:
            return f"{value:.{int(unit != 'B')}f} {unit}"
        value /= 1024.0
    return f"{value:.1f} PB"