def METHOD_NAME(
    self,
    target_experiment: Experiment | ExperimentClient | ExperimentConfig,
    max_trials: int | None = None,
) -> list[tuple[ExperimentConfig, list[Trial]]]:
    """Retrieve the trials from experiments 'similar' to `target_experiment`.
    When `max_trials` is given, only up to `max_trials` are returned in total.
    Parameters
    ----------
    target_experiment : Union[Experiment, ExperimentClient, ExperimentConfig]
        The target experiment, or experiment client, or experiment configuration.
    max_trials : int, optional
        Maximum total number of trials to fetch. By default `None`, in which case
        all trials are returned.
    Returns
    -------
    list[tuple[ExperimentConfig, list[Trial]]]
        A list of tuples of experiments and the similar trials from that experiment.
    """
    target_config: ExperimentConfig
    if isinstance(target_experiment, dict):
        target_config = target_experiment
    else:
        target_config = target_experiment.configuration
    experiment_configs = self.storage.fetch_experiments({})
    # NOTE: Here we remove the target experiment from the list of experiments.
    # This occurs because we use a singleton for the storage, so creating the target experiment
    # implicitly adds it to the storage (and to the knowledge base).
    experiment_configs = _remove_target_config(target_config, experiment_configs)
    if self.similarity_metric:
        # Order the experiments with decreasing similarity w.r.t the target experiment.
        sort_fn = partial(self.similarity_metric, target_config)
        experiment_configs = sorted(experiment_configs, key=sort_fn, reverse=True)
    return self._get_trials(experiment_configs, max_trials=max_trials)