def _query_explainability_result(
        self,
        attr: Union[dict[int, dict[str, Any]], list[dict[int, dict[str, Any]]]],
        horizon: int,
        component: Optional[str] = None,
    ) -> Any:
        """
        Helper that extracts and returns the explainability result attribute for a specified horizon and component from
        the input attribute.

        Parameters
        ----------
        attr
            An explainability result attribute from which to extract the content for a certain horizon and component.
        horizon
            The horizon for which to return the content of the attribute.
        component
            The component for which to return the content of the attribute. Does not
            need to be specified for univariate series.
        """
        component = self._validate_input_for_querying_explainability_result(
            horizon, component
        )

        if isinstance(attr, list):
            return [attr[i][horizon][component] for i in range(len(attr))]
        elif all(isinstance(key, int) for key in attr.keys()):
            return attr[horizon][component]
        else:
            raise_log(
                ValueError(
                    f"Something went wrong. {self.__class__.__name__} got instantiated with an unexpected type."
                ),
                logger,
            )

        Helper that extracts and returns the explainability result attribute for a specified horizon and component from
        the input attribute.

        Parameters
        ----------
        attr
            An explainability result attribute from which to extract the content for a certain horizon and component.
        horizon
            The horizon for which to return the content of the attribute.
        component
            The component for which to return the content of the attribute. Does not
            need to be specified for univariate series.
        
darts/explainability/explainability_result.py