'Find the minimum size required to fit in the data.'

def best_fit(self, start=None):

    if (start is None):
        start = 1
    _check_version(start)
    mode_sizes = util.mode_sizes_for_version(start)
    buffer = util.BitBuffer()
    for data in self.data_list:
        buffer.put(data.mode, 4)
        buffer.put(len(data), mode_sizes[data.mode])
        data.write(buffer)
    needed_bits = len(buffer)
    self.version = bisect_left(util.BIT_LIMIT_TABLE[self.error_correction], needed_bits, start)
    if (self.version == 41):
        raise exceptions.DataOverflowError()
    if (mode_sizes is not util.mode_sizes_for_version(self.version)):
        self.best_fit(start=self.version)
    return self.version
