class_docstr: A piece of text with associated style. Segments are produced by the Console render process and
  are ultimately converted in to strings to be written to the terminal.
  
  Args:
      text (str): A piece of text.
      style (:class:`~rich.style.Style`, optional): An optional style to apply to the text.
      control (Tuple[ControlCode], optional): Optional sequence of control codes.
  
  Attributes:
      cell_length (int): The cell length of this Segment.
docstr: Set the shape of a list of lines (enclosing rectangle).
  
          Args:
              lines (List[List[Segment]]): A list of lines.
              width (int): Desired width.
              height (int, optional): Desired height or None for no change.
              style (Style, optional): Style of any padding added.
              new_lines (bool, optional): Padded lines should include "
  ". Defaults to False.
  
          Returns:
              List[List[Segment]]: New list of lines.
          
docstr_tok: ["Set","the","shape","of","a","list","of","lines","(","enclosing","rectangle",")",".","Args",":","lines","(","List","[","List","[","Segment","]","]",")",":","A","list","of","lines",".","width","(","int",")",":","Desired","width",".","height","(","int",",","optional",")",":","Desired","height","or","None","for","no","change",".","style","(","Style",",","optional",")",":","Style","of","any","padding","added",".","new_lines","(","bool",",","optional",")",":","Padded","lines","should","include","``","''",".","Defaults","to","False",".","Returns",":","List","[","List","[","Segment","]","]",":","New","list","of","lines","."]
code: def set_shape(
      cls,
      lines: List[List["Segment"]],
      width: int,
      height: Optional[int] = None,
      style: Optional[Style] = None,
      new_lines: bool = False,
  ) -> List[List["Segment"]]:
      """Set the shape of a list of lines (enclosing rectangle).
  
      Args:
          lines (List[List[Segment]]): A list of lines.
          width (int): Desired width.
          height (int, optional): Desired height or None for no change.
          style (Style, optional): Style of any padding added.
          new_lines (bool, optional): Padded lines should include "\n". Defaults to False.
  
      Returns:
          List[List[Segment]]: New list of lines.
      """
      _height = height or len(lines)
  
      blank = (
          [cls(" " * width + "\n", style)]
          if new_lines
          else [cls(" " * width, style)]
      )
  
      adjust_line_length = cls.adjust_line_length
      shaped_lines = lines[:_height]
      shaped_lines[:] = [
          adjust_line_length(line, width, style=style) for line in lines
      ]
      if len(shaped_lines) < _height:
          shaped_lines.extend([blank] * (_height - len(shaped_lines)))
      return shaped_lines
  
imports: from enum import IntEnum
  from functools import lru_cache
  from itertools import filterfalse
  from logging import getLogger
  from operator import attrgetter
  from typing import TYPE_CHECKING, Dict, Iterable, List, NamedTuple, Optional, Sequence, Tuple, Type, Union
  from .cells import _is_single_cell_widths, cached_cell_len, cell_len, get_character_cell_size, set_cell_size
  from .repr import Result, rich_repr
  from .style import Style
label_desc: Use image node_id 15 for calling the Segment obj's underlying member method code with example usage: obj.set_shape(cls, lines, width, height, style, new_lines) and returns: shaped_lines