def _humanize_size(nbytes):
    """Transform given number of bytes to human readable unit."""
    suffix = None
    for suffix in ['B', 'KB', 'MB', 'GB']:
        if nbytes < 1024:
            break
        nbytes /= 1024
    humanized = '{:.2f}'.format(nbytes).rstrip('0').rstrip('.')
    return '{} {}'.format(humanized, suffix)
