code: def path_matches_any(text, patterns):
      """Check if the text matches any of the given wildcard patterns.
  
      NOTE: Intended for filepaths with wildcards where fnmatch is too greedy.
      Especially useful in cases where a username in a filepath may need to be wildcarded.
  
      For example;
      path_matches_any('/Users/foobar/path/to/file', {'/Users/*/path/*/file'}) == True
  
      Args:
          text (str): Text to examine
          patterns (iterable): Collection of string patterns, compatible with fnmatch (* wildcards)
  
      Returns:
          bool: True if the text matches at least one of the patterns, False otherwise.
      """
      if not isinstance(text, str):
          return False
      return any(
          pathlib2.PurePath(text).match(pattern) for pattern in patterns
      )
  
file_path: streamalert/rules/helpers/base.py
imports: from fnmatch import fnmatch
  import logging
  import json
  import random
  import time
  import pathlib2
  from streamalert.shared.utils import get_first_key, get_keys, in_network, valid_ip
label_desc: Use image node_id 1 for calling a global function with example usage: path_matches_any(text, patterns) and returns: any, False