def bytes_fmt(num):
    """Converts bytes to a human readable format

    Parameters
    ----------
    num : int,float
        Number of bytes

    Returns
    -------
    float
        Human readable format with binary prefixes
    """
    for x in ['B', 'K', 'M', 'G', 'T', 'P', 'E', 'Z']:
        if num < 1024:
            return '{:3.1f}{:s}'.format(num, x)
        num /= 1024
    else:
        return '{:3.1f}{:s}'.format(num, 'Y')
