def size_as_number_of_bytes(size):
    """Returns the minimum number of bytes needed to fit given positive
    integer.

    """
    if size == 0:
        return 1
    else:
        number_of_bits = size.bit_length()
        rest = number_of_bits % 8
        if rest != 0:
            number_of_bits += 8 - rest
        return number_of_bits // 8
