parameters: (
      cell: dict[str, Any], multirow_align: str, multicol_align: str, wrap: bool = False
  )
docstring: r"""
      Refactor the cell `display_value` if a 'colspan' or 'rowspan' attribute is present.
  
      'rowspan' and 'colspan' do not occur simultaneouly. If they are detected then
      the `display_value` is altered to a LaTeX `multirow` or `multicol` command
      respectively, with the appropriate cell-span.
  
      ``wrap`` is used to enclose the `display_value` in braces which is needed for
      column headers using an siunitx package.
  
      Requires the package {multirow}, whereas multicol support is usually built in
      to the {tabular} environment.
  
      Examples
      --------
      >>> cell = {'display_vale':'text', 'attributes': 'colspan="3"'}
      >>> _parse_latex_header_span(cell, 't', 'c')
      '\multicol{3}{c}{text}'
docstring_summary: r"""
      Refactor the cell `display_value` if a 'colspan' or 'rowspan' attribute is present.
docstring_tokens: r Refactor the cell display_value if a colspan or rowspan attribute is present .
function: def _parse_latex_header_span(
      cell: dict[str, Any], multirow_align: str, multicol_align: str, wrap: bool = False
  ) -> str:
      r"""
      Refactor the cell `display_value` if a 'colspan' or 'rowspan' attribute is present.
  
      'rowspan' and 'colspan' do not occur simultaneouly. If they are detected then
      the `display_value` is altered to a LaTeX `multirow` or `multicol` command
      respectively, with the appropriate cell-span.
  
      ``wrap`` is used to enclose the `display_value` in braces which is needed for
      column headers using an siunitx package.
  
      Requires the package {multirow}, whereas multicol support is usually built in
      to the {tabular} environment.
  
      Examples
      --------
      >>> cell = {'display_vale':'text', 'attributes': 'colspan="3"'}
      >>> _parse_latex_header_span(cell, 't', 'c')
      '\multicol{3}{c}{text}'
      """
      if "attributes" in cell:
          attrs = cell["attributes"]
          if 'colspan="' in attrs:
              colspan = attrs[attrs.find('colspan="') + 9 :]  # len('colspan="') = 9
              colspan = int(colspan[: colspan.find('"')])
              return (
                  f"\\multicolumn{{{colspan}}}{{{multicol_align}}}"
                  f"{{{cell['display_value']}}}"
              )
          elif 'rowspan="' in attrs:
              rowspan = attrs[attrs.find('rowspan="') + 9 :]
              rowspan = int(rowspan[: rowspan.find('"')])
              return (
                  f"\\multirow[{multirow_align}]{{{rowspan}}}{{*}}"
                  f"{{{cell['display_value']}}}"
              )
      if wrap:
          return f"{{{cell['display_value']}}}"
      else:
          return cell["display_value"]
function_tokens: def _parse_latex_header_span ( cell : dict [ str , Any ] , multirow_align : str , multicol_align : str , wrap : bool = False ) -> str : if "attributes" in cell : attrs = cell [ "attributes" ] if 'colspan="' in attrs : colspan = attrs [ attrs . find ( 'colspan="' ) + 9 : ] # len('colspan="') = 9 colspan = int ( colspan [ : colspan . find ( '"' ) ] ) return ( f"\\multicolumn{{{colspan}}}{{{multicol_align}}}" f"{{{cell['display_value']}}}" ) elif 'rowspan="' in attrs : rowspan = attrs [ attrs . find ( 'rowspan="' ) + 9 : ] rowspan = int ( rowspan [ : rowspan . find ( '"' ) ] ) return ( f"\\multirow[{multirow_align}]{{{rowspan}}}{{*}}" f"{{{cell['display_value']}}}" ) if wrap : return f"{{{cell['display_value']}}}" else : return cell [ "display_value" ]