def ppsize(num):
    """pretty-print filesize.
    http://blogmag.net/blog/read/38/Print_human_readable_file_size"""
    for x in ['bytes', 'KiB', 'MiB', 'GiB', 'TB']:
        if num < 1024.0:
            return '%3.2f %s' % (num, x)
        num /= 1024.0
