code: def matchkeyword(colitem, keywordexpr):
      """Tries to match given keyword expression to given collector item.
  
      Will match on the name of colitem, including the names of its parents.
      Only matches names of items which are either a :class:`Class` or a
      :class:`Function`.
      Additionally, matches on names in the 'extra_keyword_matches' set of
      any item, as well as names directly assigned to test functions.
      """
      mapping = KeywordMapping.from_item(colitem)
      if " " not in keywordexpr:
          # special case to allow for simple "-k pass" and "-k 1.3"
          return mapping[keywordexpr]
      elif (
          keywordexpr.startswith("not ") and " " not in keywordexpr[4:]
      ):
          return not mapping[keywordexpr[4:]]
      for kwd in keywordexpr.split():
          if (
              keyword.iskeyword(kwd)
              and kwd not in python_keywords_allowed_list
          ):
              raise UsageError(
                  "Python keyword '{}' not accepted in expressions passed to '-k'".format(
                      kwd
                  )
              )
      try:
          return eval(keywordexpr, {}, mapping)
      except SyntaxError:
          raise UsageError(
              "Wrong expression passed to '-k': {}".format(keywordexpr)
          )
  
file_path: catboost/contrib/python/pytest/py2/_pytest/mark/legacy.py
imports: import keyword
  import attr
  from _pytest.config import UsageError
label_desc: Use image node_id 2 for calling a global function with example usage: matchkeyword(colitem, keywordexpr) and returns: mapping, eval, unknown