def format_size(size):
    """ Format into byes, KB, MB & GB """

    power = 2**10
    i = 0
    power_labels = {0: 'bytes', 1: 'KB', 2: 'MB', 3: 'GB'}
    while size > power:
        size /= power
        i += 1
    return f"{round(size, 2)} {power_labels[i]}"