code: def check_key(key, allowed):
      
  
      if key in allowed:
          return True
  
      for pattern in allowed:
          if fnmatch(key, pattern):
              return True
  
      return False
docs: Validate that the specified key is allowed according the provided
      list of patterns.