code: def fnmatch_ex(pattern, path):
      """FNMatcher port from py.path.common which works with PurePath() instances.
  
      The difference between this algorithm and PurePath.match() is that the latter matches "**" glob expressions
      for each part of the path, while this algorithm uses the whole path instead.
  
      For example:
          "tests/foo/bar/doc/test_foo.py" matches pattern "tests/**/doc/test*.py" with this algorithm, but not with
          PurePath.match().
  
      This algorithm was ported to keep backward-compatibility with existing settings which assume paths match according
      this logic.
  
      References:
      * https://bugs.python.org/issue29249
      * https://bugs.python.org/issue34731
      """
      path = PurePath(path)
      iswin32 = sys.platform.startswith("win")
  
      if iswin32 and sep not in pattern and posix_sep in pattern:
          # Running on Windows, the pattern has no Windows path separators,
          # and the pattern has one or more Posix path separators. Replace
          # the Posix path separators with the Windows path separator.
          pattern = pattern.replace(posix_sep, sep)
  
      if sep not in pattern:
          name = path.name
      else:
          name = six.text_type(path)
      return fnmatch.fnmatch(name, pattern)
  
imports: from __future__ import absolute_import
  import atexit
  import errno
  import fnmatch
  import itertools
  import operator
  import os
  import shutil
  import sys
  import uuid
  import warnings
  from functools import partial
  from functools import reduce
  from os.path import expanduser
  from os.path import expandvars
  from os.path import isabs
  from os.path import sep
  from posixpath import sep
  import six
  from six.moves import map
  from .compat import PY36
  from _pytest.warning_types import PytestWarning
label_desc: Use image node_id 19 for calling a global function with example usage: fnmatch_ex(pattern, path) and returns: fnmatch