docs: def add_derivatives(self, path, **kwargs):
          ''' Add BIDS-Derivatives datasets to tracking.
  
          Args:
              path (str, list): One or more paths to BIDS-Derivatives datasets.
                  Each path can point to either a derivatives/ directory
                  containing one more more pipeline directories, or to a single
                  pipeline directory (e.g., derivatives/fmriprep).
              kwargs (dict): Optional keyword arguments to pass on to
                  BIDSLayout() when initializing each of the derivative datasets.
  
          Note: Every derivatives directory intended for indexing MUST contain a
              valid dataset_description.json file. See the BIDS-Derivatives
              specification for details.
          '''
          paths = listify(path)
          deriv_dirs = []
  
          # Collect all paths that contain a dataset_description.json
          def check_for_description(dir):
              dd = os.path.join(dir, 'dataset_description.json')
              return os.path.exists(dd)
  
          for p in paths:
              p = os.path.abspath(p)
              if os.path.exists(p):
                  if check_for_description(p):
                      deriv_dirs.append(p)
                  else:
                      subdirs = [d for d in os.listdir(p)
                                 if os.path.isdir(os.path.join(p, d))]
                      for sd in subdirs:
                          sd = os.path.join(p, sd)
                          if check_for_description(sd):
                              deriv_dirs.append(sd)
  
          if not deriv_dirs:
              warnings.warn("Derivative indexing was enabled, but no valid "
                            "derivatives datasets were found in any of the "
                            "provided or default locations. Please make sure "
                            "all derivatives datasets you intend to index "
                            "contain a 'dataset_description.json' file, as "
                            "described in the BIDS-derivatives specification.")
  
          for deriv in deriv_dirs:
              dd = os.path.join(deriv, 'dataset_description.json')
              with open(dd, 'r', encoding='utf-8') as ddfd:
                  description = json.load(ddfd)
              pipeline_name = description.get(
                  'PipelineDescription', {}).get('Name')
              if pipeline_name is None:
                  raise ValueError("Every valid BIDS-derivatives dataset must "
                                   "have a PipelineDescription.Name field set "
                                   "inside dataset_description.json.")
              if pipeline_name in self.derivatives:
                  raise ValueError("Pipeline name '%s' has already been added "
                                   "to this BIDSLayout. Every added pipeline "
                                   "must have a unique name!")
              # Default config and sources values
              kwargs['config'] = kwargs.get('config') or ['bids', 'derivatives']
              kwargs['sources'] = kwargs.get('sources') or self
              self.derivatives[pipeline_name] = BIDSLayout(deriv, **kwargs)
  
          # Consolidate all entities post-indexing. Note: no conflicts occur b/c
          # multiple entries with the same name all point to the same instance.
          for deriv in self.derivatives.values():
              self.entities.update(deriv.entities)