code: def pickle_load(cls, filepath, spectator_mode=True, remove_lock=False):
          
          if os.path.isdir(filepath):
              # Walk through each directory inside path and find the pickle database.
              for dirpath, dirnames, filenames in os.walk(filepath):
                  fnames = [f for f in filenames if f == cls.PICKLE_FNAME]
                  if fnames:
                      if len(fnames) == 1:
                          filepath = os.path.join(dirpath, fnames[0])
                          break  # Exit os.walk
                      else:
                          err_msg = "Found multiple databases:\n %s" % str(fnames)
                          raise RuntimeError(err_msg)
              else:
                  err_msg = "Cannot find %s inside directory %s" % (cls.PICKLE_FNAME, filepath)
                  raise ValueError(err_msg)
  
          if remove_lock and os.path.exists(filepath + ".lock"):
              try:
                  os.remove(filepath + ".lock")
              except:
                  pass
  
          with FileLock(filepath):
              with open(filepath, "rb") as fh:
                  flow = pmg_pickle_load(fh)
  
          # Check if versions match.
          if flow.VERSION != cls.VERSION:
              msg = ("File flow version %s != latest version %s\n."
                     "Regenerate the flow to solve the problem " % (flow.VERSION, cls.VERSION))
              warnings.warn(msg)
  
          flow.set_spectator_mode(spectator_mode)
  
          # Recompute the status of each task since tasks that
          # have been submitted previously might be completed.
          flow.check_status()
          return flow
docs: Loads the object from a pickle file and performs initial setup.
  
          Args:
              filepath: Filename or directory name. It filepath is a directory, we
                  scan the directory tree starting from filepath and we
                  read the first pickle database. Raise RuntimeError if multiple
                  databases are found.
              spectator_mode: If True, the nodes of the flow are not connected by signals.
                  This option is usually used when we want to read a flow
                  in read-only mode and we want to avoid callbacks that can change the flow.
              remove_lock:
                  True to remove the file lock if any (use it carefully).