def check_key(key, allowed):
if key in allowed:<EOL><INDENT>return True<EOL><DEDENT>for pattern in allowed:<EOL><INDENT>if fnmatch(key, pattern):<EOL><INDENT>return True<EOL><DEDENT><DEDENT>return False<EOL>
Validate that the specified key is allowed according the provided
list of patterns.