def METHOD_NAME(cls, id: str) -> Optional[Union[ServicePythonMetric, str]]:
    """
    Finds a metric by id
    Parameters
    ----------
    id:
        The metric id
    Returns
    -------
        Found metric if any, ``None`` otherwise
    """
    for metric in cls.metrics:
        if isinstance(metric, str) and metric == id:
            return metric
        if metric.id == id:
            return metric