code: def _fix_a_slash_b(string: str) -> str:
      """Source: https://github.com/hendrycks/math
  
      Reformat fractions formatted as a/b to \\frac{a}{b}.
  
      Example:
      >>> _fix_a_slash_b("2/3")
      \frac{2}{3}
      """
      if len(string.split("/")) != 2:
          return string
      a_str = string.split("/")[0]
      b_str = string.split("/")[1]
      try:
          a = int(a_str)
          b = int(b_str)
          assert string == "{}/{}".format(a, b)
          new_string = "\\frac{" + str(a) + "}{" + str(b) + "}"
          return new_string
      except Exception:
          return string
  
file_path: H2O/h2o_hf/helm/src/helm/benchmark/scenarios/math_scenario.py
imports: import collections
  import typing
  from typing import Dict, List, Optional
  from datasets import load_dataset, DatasetDict
  from .scenario import Scenario, Instance, Reference, TRAIN_SPLIT, TEST_SPLIT, CORRECT_TAG, Input, Output
label_desc: Use image node_id 4 for calling a global function with example usage: _fix_a_slash_b(string) and returns: string, new_string, string