code: def glob_to_regex(glob):
      if not isinstance(glob, str):
          raise ValueError("Glob pattern must be a string")
      pattern = fnmatch.translate(glob)
      # fnmatch adds special character to match the end of the string, so that when used
      # with re.match it, by default, matches the whole string. Here, it's going to be used
      # with re.search so it would be weird to enforce matching the suffix, but not the prefix.
      if pattern[-2:] == r"\Z":
          pattern = pattern[:-2]
      return pattern
  
file_path: DALI/dali/test/python/nose_utils.py
imports: import sys
  import collections
  import nose.case
  import nose.inspector
  import nose.loader
  import nose.suite
  import nose.plugins.attrib
  import nose.tools
  import re
  import fnmatch
label_desc: Use image node_id 1 for calling a global function with example usage: glob_to_regex(glob) and returns: pattern