def METHOD_NAME(self, metric_list: collections.abc.Sequence):
    metrics = {}
    metric_dataset_names = {}
    for metric in metric_list:
        params = {}
        dataset_names = []
        if isinstance(metric, collections.abc.Mapping):
            if "type" not in metric:
                raise ValueError(
                    f"Metric {metric} needs to have 'type' attribute "
                    + "or should be a string"
                )
            metric_type = key = metric.type
            params = metric.get("params", {})
            # Support cases where uses need to give custom metric name
            if "key" in metric:
                key = metric.key
            # One key should only be used once
            if key in metrics:
                raise RuntimeError(
                    f"Metric with type/key '{metric_type}' has been defined more "
                    + "than once in metric list."
                )
            # a custom list of dataset where this metric will be applied
            if "datasets" in metric:
                dataset_names = metric.datasets
            else:
                logger.warning(
                    f"metric '{key}' will be computed on all datasets \
                    since datasets are not provided"
                )
        else:
            if not isinstance(metric, str):
                raise TypeError(
                    "Metric {} has inappropriate type"
                    "'dict' or 'str' allowed".format(metric)
                )
            metric_type = key = metric
        metric_cls = registry.get_torchmetric_class(metric_type)
        if metric_cls is None:
            raise ValueError(
                f"No metric named {metric_type} registered to registry"
            )
        metric_instance = metric_cls(**params)
        metrics[key] = metric_instance
        metric_dataset_names[key] = dataset_names
    return metrics, metric_dataset_names