code: def search_files(files, suffix=None, recursion_depth=0):
      """
      Returns the files matching the given `suffix`.
  
      Parameters
      ----------
      files : str or list
          File, path or a list thereof to be searched / filtered.
      suffix : str, optional
          Return only files matching this suffix.
      recursion_depth : int, optional
          Recursively search sub-directories up to this depth.
  
      Returns
      -------
      list
          List of files.
  
      Notes
      -----
      The list of returned files is sorted.
  
      """
      import os
  
      file_list = []
      # determine the files
      if isinstance(files, list):
          # a list is given, recursively call the function on each element
          for f in files:
              file_list.extend(search_files(f))
      elif os.path.isdir(files):
          # add all files in the given path (up to the given recursion depth)
          file_list.extend(search_path(files, recursion_depth))
      elif os.path.isfile(files):
          # add the given file
          file_list.append(files)
      else:
          raise IOError("%s does not exist." % files)
      # filter with the given suffix
      if suffix is not None:
          file_list = filter_files(file_list, suffix)
      # remove duplicates
      file_list = list(set(file_list))
      # 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 4 for calling a global function with example usage: search_files(files, suffix, recursion_depth) and returns: sorted