code: def disable_inside(item, *elems, **kwargs):
      
      _invert = kwargs.get("_invert", False)
      internal_assert(set(kwargs.keys()) <= set(("_invert",)), "excess keyword arguments passed to disable_inside")
  
      level = [0]  # number of wrapped items deep we are; in a list to allow modification
  
      @contextmanager
      def manage_item(self, instring, loc):
          level[0] += 1
          try:
              yield
          finally:
              level[0] -= 1
  
      yield Wrap(item, manage_item)
  
      @contextmanager
      def manage_elem(self, instring, loc):
          if level[0] == 0 if not _invert else level[0] > 0:
              yield
          else:
              raise ParseException(instring, loc, self.errmsg, self)
  
      for elem in elems:
          yield Wrap(elem, manage_elem)
docs: Prevent elems from matching inside of item.
  
      Returns (item with elem disabled, *new versions of elems).