Returns a list of all files ending in `suffix` contained within `path`.

  Parameters
  ----------
  path : str
      a filepath
  suffix : str

  Returns
  -------
  l : list
      A list of all files ending in `suffix` contained within `path`.
      (If `path` is a file rather than a directory, it is considered
      to "contain" itself)

def _list_files(path, suffix=""):
  """
  Returns a list of all files ending in `suffix` contained within `path`.

  Parameters
  ----------
  path : str
      a filepath
  suffix : str

  Returns
  -------
  l : list
      A list of all files ending in `suffix` contained within `path`.
      (If `path` is a file rather than a directory, it is considered
      to "contain" itself)
  """
  if os.path.isdir(path):
    incomplete = os.listdir(path)
    complete = [os.path.join(path, entry) for entry in incomplete]
    lists = [_list_files(subpath, suffix) for subpath in complete]
    flattened = []
    for one_list in lists:
      for elem in one_list:
        flattened.append(elem)
    return flattened
  else:
    assert os.path.exists(path), "couldn't find file '%s'" % path
    if path.endswith(suffix):
      return [path]
    return []