def format_size(size):
    """
    This method formats an arbitrary amount of bytes to a printable
    string. For example 1024 will be converted to 1.0 kB.
    :param size: an amount of bytes
    :return: a string that's ready to be printed representing
             approximately the amount of bytes in a human readable
             way.
    """
    scales = ["bytes", "kB", "MB", "GB", "TB", "PB"]
    count = 0
    while (1 == 1):
        if (size > 1024.0):
            size /= 1024.0
            count += 1
        else:
            break
    return str(round(size, 1)) + " " + scales[count]