code: def _strip_string(string: str) -> str:
      """Source: https://github.com/hendrycks/math
      Apply the reformatting helper functions above.
      """
      # linebreaks
      string = string.replace("\n", "")
      # print(string)
  
      # remove inverse spaces
      string = string.replace("\\!", "")
      # print(string)
  
      # replace \\ with \
      string = string.replace("\\\\", "\\")
      # print(string)
  
      # replace tfrac and dfrac with frac
      string = string.replace("tfrac", "frac")
      string = string.replace("dfrac", "frac")
      # print(string)
  
      # remove \left and \right
      string = string.replace("\\left", "")
      string = string.replace("\\right", "")
      # print(string)
  
      # Remove circ (degrees)
      string = string.replace("^{\\circ}", "")
      string = string.replace("^\\circ", "")
  
      # remove dollar signs
      string = string.replace("\\$", "")
  
      # remove units (on the right)
      string = _remove_right_units(string)
  
      # remove percentage
      string = string.replace("\\%", "")
      string = string.replace("%", "")
  
      # " 0." equivalent to " ." and "{0." equivalent to "{." Alternatively, add "0" if "." is the start of the string
      string = string.replace(" .", " 0.")
      string = string.replace("{.", "{0.")
      # if empty, return empty string
      if len(string) == 0:
          return string
      if string[0] == ".":
          string = "0" + string
  
      # to consider: get rid of e.g. "k = " or "q = " at beginning
      if len(string.split("=")) == 2:
          if len(string.split("=")[0]) <= 2:
              string = string.split("=")[1]
  
      # fix sqrt3 --> sqrt{3}
      string = _fix_sqrt(string)
  
      # remove spaces
      string = string.replace(" ", "")
  
      # \frac1b or \frac12 --> \frac{1}{b} and \frac{1}{2}, etc.
      # Even works with \frac1{72} (but not \frac{72}1).
      # Also does a/b --> \\frac{a}{b}
      string = _fix_fracs(string)
  
      # manually change 0.5 --> \frac{1}{2}
      if string == "0.5":
          string = "\\frac{1}{2}"
  
      # NOTE: X/Y changed to \frac{X}{Y} in dataset, but in simple cases fix in case the model output is X/Y
      string = _fix_a_slash_b(string)
  
      return string
  
file_path: autogen/autogen/math_utils.py
imports: from typing import Optional
  from autogen import oai, DEFAULT_MODEL
label_desc: Use image node_id 8 for calling a global function with example usage: _strip_string(string) and returns: string, string