def file_size_display(size, precision):
    """Displays human-readable file information, to [precision] decimal places"""
    suffixes = ['B', 'KiB', 'MiB', 'GiB', 'TiB', 'PiB']
    suffixIndex = 0
    while size > 1024 and suffixIndex < 5:
        suffixIndex += 1
        size = size / 1024.0
    return '%.*f%s' % (precision, size, suffixes[suffixIndex])
