code: def search_module(mod, pat, ignore_case=True, recursive=False, _seen=None):
      r
      if _seen is not None and mod in _seen:
          return []
      import utool as ut
      reflags = re.IGNORECASE * ignore_case
      found_list = [name for name in dir(mod) if re.search(pat, name, flags=reflags)]
      if recursive:
          if _seen is None:
              _seen = set()
          _seen.add(mod)
          module_attrs = [getattr(mod, name) for name in dir(mod)]
          submodules = [
              submod for submod in module_attrs
              if isinstance(submod, types.ModuleType) and submod not in _seen and
              ut.is_defined_by_module(submod, mod)
          ]
          for submod in submodules:
              found_list += search_module(submod, pat, ignore_case=ignore_case, recursive=recursive, _seen=_seen)
      found_list = ut.unique_ordered(found_list)
      return found_list