code: def find_depth(data, s='', level=None):
      
      # remove wildcard as last character from string, escape regex characters
      _s = re.compile('^' + _escape_regexp(s.rstrip('*')))
      _p = re.compile('\\|')
  
      # find depth
      def _count_pipes(val):
          return len(_p.findall(re.sub(_s, '', val))) if _s.match(val) else None
  
      n_pipes = map(_count_pipes, data)
  
      # if no level test is specified, return the depth as int
      if level is None:
          return list(n_pipes)
  
      # if `level` is given, set function for finding depth level =, >=, <= |s
      if not isstr(level):
          test = lambda x: level == x if x is not None else False
      elif level[-1] == '-':
          level = int(level[:-1])
          test = lambda x: level >= x if x is not None else False
      elif level[-1] == '+':
          level = int(level[:-1])
          test = lambda x: level <= x if x is not None else False
      else:
          raise ValueError('Unknown level type: `{}`'.format(level))
  
      return list(map(test, n_pipes))
docs: return or assert the depth (number of `|`) of variables
  
      Parameters
      ----------
      data : pd.Series of strings
          IAMC-style variables
      s : str, default ''
          remove leading `s` from any variable in `data`
      level : int or str, default None
          if None, return depth (number of `|`); else, return list of booleans
          whether depth satisfies the condition (equality if `level` is int,
          >= if `.+`,  <= if `.-`)