code: def listfiles(pattern, restriction=None, omit_value=None):
      """Yield a tuple of existing filepaths for the given pattern.
  
      Wildcard values are yielded as the second tuple item.
  
      Args:
          pattern (str):       a filepattern. Wildcards are specified in snakemake syntax, e.g. "{id}.txt"
          restriction (dict):  restrict to wildcard values given in this dictionary
          omit_value (str):    wildcard value to omit
  
      Yields:
          tuple: The next file matching the pattern, and the corresponding wildcards object
      """
      pattern = os.path.normpath(pattern)
      first_wildcard = re.search("{[^{]", pattern)
      if first_wildcard:
          dirname = os.path.dirname(pattern[: first_wildcard.start()])
          if not dirname:
              dirname = "."
      else:
          dirname = os.path.dirname(pattern)
      pattern = re.compile(regex_from_filepattern(pattern))
  
      for dirpath, dirnames, filenames in os.walk(dirname):
          for f in chain(filenames, dirnames):
              if dirpath != ".":
                  f = os.path.normpath(os.path.join(dirpath, f))
              match = re.match(pattern, f)
              if match:
                  wildcards = Namedlist(fromdict=match.groupdict())
                  if restriction is not None:
                      invalid = any(
                          omit_value not in v and v != wildcards[k]
                          for k, v in restriction.items()
                      )
                      if not invalid:
                          yield f, wildcards
                  else:
                      yield f, wildcards
  
imports: import os
  import json
  import re
  import inspect
  import textwrap
  from itertools import chain
  import collections
  import multiprocessing
  import string
  import shlex
  import sys
  from urllib.parse import urljoin
  from snakemake.io import Namedlist, Wildcards
  from snakemake.common.configfile import _load_configfile
  from snakemake.logging import logger
  from snakemake.common import ON_WINDOWS
  from snakemake.exceptions import WorkflowError
  from snakemake.io import regex_from_filepattern
label_desc: Use image node_id 4 for calling a global function with example usage: listfiles(pattern, restriction, omit_value) without return types