code: def get_elem(elem_ref, default=None):
      
      if not is_elem_ref(elem_ref):
          return elem_ref
      elif elem_ref[0] == ElemRefObj:
          return getattr(elem_ref[1], elem_ref[2], default)
      elif elem_ref[0] == ElemRefArr:
          return elem_ref[1][elem_ref[2]]
docs: Gets the element referenced by elem_ref or returns the elem_ref directly if its not a reference.
  
      :param elem_ref:
      :param default:
      :return: