def hrsize(size):
    """Return human-readable size from size value"""
    if size < 1000:
        return '%d%s' % (size, 'B')
    for suffix in 'KMGTPEZY':
        size /= 1024.0
        if size < 10.0:
            return '%.1f%sB' % (size, suffix)
        if size < 1000.0:
            return '%.0f%sB' % (size, suffix)
    return '%.0f%sB' % (size, 'Y')
