def matchkeyword(colitem, keywordexpr):
mapping = KeywordMapping.from_item(colitem)<EOL>if "<STR_LIT:U+0020>" not in keywordexpr:<EOL><INDENT>return mapping[keywordexpr]<EOL><DEDENT>elif keywordexpr.startswith("<STR_LIT>") and "<STR_LIT:U+0020>" not in keywordexpr[<NUM_LIT:4>:]:<EOL><INDENT>return not mapping[keywordexpr[<NUM_LIT:4>:]]<EOL><DEDENT>for kwd in keywordexpr.split():<EOL><INDENT>if keyword.iskeyword(kwd) and kwd not in python_keywords_allowed_list:<EOL><INDENT>raise UsageError(<EOL>"<STR_LIT>".format(<EOL>kwd<EOL>)<EOL>)<EOL><DEDENT><DEDENT>try:<EOL><INDENT>return eval(keywordexpr, {}, mapping)<EOL><DEDENT>except SyntaxError:<EOL><INDENT>raise UsageError("<STR_LIT>".format(keywordexpr))<EOL><DEDENT>
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.