code: def load_data(filepath, all_folders=False, **kwargs):
      """Create pandas data frame from filepath.
  
      Args:
          filepath: The file path. Can be either a local filepath or Google Cloud Storage URI filepath
          all_folders: If True, searches for text files in nested folders. If False, looks for text files in the current folder
          **kwargs: Keyword arguments to pass to the reader
  
      Raises:
          ImportError: gcsfs not installed.
          FileNotFoundError: File doesn't exist.
  
      Returns:
          A pandas data frame
      """
      if os.path.isfile(filepath):
          df = _read_file_type(filepath, **kwargs)
      elif "gs://" in filepath:
          if _compat.check_install("gcsfs"):
              df = _read_file_type(filepath, **kwargs)
          else:
              raise ImportError(
                  "Package gcsfs required to load from GCS"
              )
      elif os.path.isdir(filepath):
          text = []
          encoding = kwargs.pop("encoding", "utf-8")
          if not all_folders:
              for file in os.listdir(filepath):
                  if os.path.isfile(
                      os.path.join(filepath, file)
                  ) and file.endswith(".txt"):
                      with open(
                          os.path.join(filepath, file),
                          "r",
                          encoding=encoding,
                      ) as f:
                          text.append(f.read())
          else:
              for root, _, files in os.walk(filepath):
                  for file in files:
                      if file.endswith(".txt"):
                          with open(
                              os.path.join(root, file),
                              "r",
                              encoding=encoding,
                          ) as f:
                              text.append(f.read())
          df = pd.DataFrame(text)
      else:
          raise FileNotFoundError(
              "{} not a valid path".format(filepath)
          )
      return df
  
imports: import os
  import tempfile
  import pandas
  from data_describe.compat import _compat, _requires
  from data_describe.misc.file_ext import _FileExtensionTypes, is_filetype
label_desc: Use image node_id 1 for calling a global function with example usage: load_data(filepath, all_folders) and returns: df