code: def module_list(path):
      """
      Return the list containing the names of the modules available in the given
      folder.
      """
      # sys.path has the cwd as an empty string, but isdir/listdir need it as '.'
      if path == "":
          path = "."
  
      # A few local constants to be used in loops below
      pjoin = os.path.join
  
      if os.path.isdir(path):
          # Build a list of all files in the directory and all files
          # in its subdirectories. For performance reasons, do not
          # recurse more than one level into subdirectories.
          files = []
          for root, dirs, nondirs in os.walk(path, followlinks=True):
              subdir = root[len(path) + 1 :]
              if subdir:
                  files.extend(pjoin(subdir, f) for f in nondirs)
                  dirs[
                      :
                  ] = (
                      []
                  )  # Do not recurse into additional subdirectories.
              else:
                  files.extend(nondirs)
  
      else:
          try:
              files = list(zipimporter(path)._files.keys())
          except:
              files = []
  
      # Build a list of modules which match the import_re regex.
      modules = []
      for f in files:
          m = import_re.match(f)
          if m:
              modules.append(m.group("name"))
      return list(set(modules))
  
imports: from __future__ import print_function
  import glob
  import inspect
  import itertools
  import os
  import re
  import sys
  from time import time
  from zipimport import zipimporter
  from IPython.core.completer import expand_user, compress_user
  from IPython.core.error import TryNext
  from IPython.utils._process_common import arg_split
  from IPython.utils.py3compat import string_types
  from IPython import get_ipython
  from __res import importer
label_desc: Use image node_id 4 for calling a global function with example usage: module_list(path) and returns: list