code: def search_path(path, recursion_depth=0):
      """
      Returns a list of files in a directory (recursively).
  
      Parameters
      ----------
      path : str or list
          Directory to be searched.
      recursion_depth : int, optional
          Recursively search sub-directories up to this depth.
  
      Returns
      -------
      list
          List of files.
  
      """
      # adapted from http://stackoverflow.com/a/234329
      import os
  
      # remove the rightmost path separator (needed for recursion depth count)
      path = path.rstrip(os.path.sep)
      # we can only handle directories
      if not os.path.isdir(path):
          raise IOError("%s is not a directory." % path)
      # files to be returned
      file_list = []
      # keep track of the initial recursion depth
      initial_depth = path.count(os.path.sep)
      for root, dirs, files in os.walk(path):
          # add all files of this directory to the list
          for f in files:
              file_list.append(os.path.join(root, f))
          # remove all sub directories exceeding the wanted recursion depth
          if initial_depth + recursion_depth <= root.count(os.path.sep):
              del dirs[:]
      # return the sorted file list
      return sorted(file_list)
  
imports: from __future__ import absolute_import, division, print_function
  import argparse
  import contextlib
  import io
  import numpy
label_desc: Use image node_id 3 for calling a global function with example usage: search_path(path, recursion_depth) and returns: sorted