code: def _divide_widths(self, cli, width):
          
          if not self.children:
              return []
  
          # Calculate widths.
          given_dimensions = self.get_dimensions(cli) if self.get_dimensions else None
  
          def get_dimension_for_child(c, index):
              if given_dimensions and given_dimensions[index] is not None:
                  return given_dimensions[index]
              else:
                  return c.preferred_width(cli, width)
  
          dimensions = [get_dimension_for_child(c, index) for index, c in enumerate(self.children)]
  
          # Sum dimensions
          sum_dimensions = sum_layout_dimensions(dimensions)
  
          # If there is not enough space for both.
          # Don't do anything.
          if sum_dimensions.min > width:
              return
  
          # Find optimal sizes. (Start with minimal size, increase until we cover
          # the whole height.)
          sizes = [d.min for d in dimensions]
  
          child_generator = take_using_weights(
              items=list(range(len(dimensions))),
              weights=[d.weight for d in dimensions])
  
          i = next(child_generator)
  
          while sum(sizes) < min(width, sum_dimensions.preferred):
              # Increase until we meet at least the 'preferred' size.
              if sizes[i] < dimensions[i].preferred:
                  sizes[i] += 1
              i = next(child_generator)
  
          while sum(sizes) < min(width, sum_dimensions.max):
              # Increase until we use all the available space.
              if sizes[i] < dimensions[i].max:
                  sizes[i] += 1
              i = next(child_generator)
  
          return sizes
docs: Return the widths for all columns.
          Or None when there is not enough space.