def human_format(num: int) -> str:
    """Returns num in human-redabale format

    from https://stackoverflow.com/a/579376

    Args:
        num (int): number.

    Returns:
        str: Human-readable number.
    """
    # f

    if num < 10000:
        return str(num)

    magnitude = 0
    while abs(num) >= 1000:
        magnitude += 1
        num /= 1000.0  # type: ignore

    if num == int(num):
        formatter = "%.1d%s"
    else:
        formatter = "%.1f%s"

    return formatter % (num, ["", "K", "M", "G", "T", "P"][magnitude])