code: def _ensure_term(where, scope_level):
      
  
      # only consider list/tuple here as an ndarray is automatically a coordinate
      # list
      level = scope_level + 1
      if isinstance(where, (list, tuple)):
          wlist = []
          for w in filter(lambda x: x is not None, where):
              if not maybe_expression(w):
                  wlist.append(w)
              else:
                  wlist.append(Term(w, scope_level=level))
          where = wlist
      elif maybe_expression(where):
          where = Term(where, scope_level=level)
      return where
docs: ensure that the where is a Term or a list of Term
      this makes sure that we are capturing the scope of variables
      that are passed
      create the terms here with a frame_level=2 (we are 2 levels down)