code: def user_loc_value_to_class(axis_tag, user_loc):
      
      if axis_tag == "wght":
          return int(user_loc)
      elif axis_tag == "wdth":
          return min(
              sorted(WIDTH_CLASS_TO_VALUE.items()),
              key=lambda item: abs(item[1] - user_loc),
          )[0]
  
      raise NotImplementedError
docs: Return the OS/2 weight or width class that is closest to the provided
      user location. For weight the user location is between 0 and 1000 and for
      width it is a percentage.
  
      >>> user_loc_value_to_class('wght', 310)
      310
      >>> user_loc_value_to_class('wdth', 62)
      2