code: def _get_table_width(table_spec):
      
  
      # Remove things like {\bfseries}
      cleaner_spec = re.sub(r'{[^}]*}', '', table_spec)
  
      # Remove X[] in tabu environments so they dont interfere with column count
      cleaner_spec = re.sub(r'X\[(.*?(.))\]', r'\2', cleaner_spec)
      spec_counter = Counter(cleaner_spec)
  
      return sum(spec_counter[l] for l in COLUMN_LETTERS)
docs: Calculate the width of a table based on its spec.
  
      Args
      ----
      table_spec: str
          The LaTeX column specification for a table.
  
  
      Returns
      -------
      int
          The width of a table which uses the specification supplied.