def bytefmt(num, fmt='{:.2f}'):
    """
        format a value of bytes to a more human readable pattern
        example: 15 * 1024 becomes 15KiB

        Args:

            num (int): bytes

            fmt (string): format

        Return: string
    """
    for unit in ['', 'Ki', 'Mi', 'Gi']:
        if num < 1024.0:
            return '{}{}B'.format(fmt, unit).format(num)
        num /= 1024.0
    return '{}GiB'.format(fmt).format(num * 1024.0)
