code: def _get_file_match(dir, name="*"):
      targets = (name, ("[!_]*.py"), ("[!_]*.sh"))
      lgr.debug("Looking for procedure '%s' in '%s'", name, dir)
      for target in targets:
          for m in iglob(op.join(dir, target)):
              m_bn = op.basename(m)
              if name == "*":
                  report_name = (
                      m_bn[:-3]
                      if m_bn.endswith(".py") or m_bn.endswith(".sh")
                      else m_bn
                  )
                  yield m, report_name
              elif m_bn == name or m_bn.startswith("{}.".format(name)):
                  yield m, name
  
imports: import logging
  import os
  import os.path
  import stat
  import sys
  from argparse import REMAINDER
  from glob import iglob
  import datalad.support.ansi_colors
  from datalad import cfg
  from datalad.core.local.run import Run
  from datalad.distribution.dataset import Dataset, EnsureDataset, datasetmethod, require_dataset
  from datalad.interface.base import Interface, build_doc, eval_results
  from datalad.interface.results import get_status_dict
  from datalad.support.constraints import EnsureNone
  from datalad.support.exceptions import InsufficientArgumentsError, NoDatasetFound
  from datalad.support.param import Parameter
  from datalad.utils import ensure_list, guard_for_format, join_cmdline, quote_cmdlinearg, split_cmdline
label_desc: Use image node_id 1 for calling a global function with example usage: _get_file_match(dir, name) without return types