class_docstr: Base class encapsulating related task metrics
  
  Attributes:
  -----------
  
  metrics:
      A list of configured metrics for task
class_docstr_tok: ["Base","class","encapsulating","related","task","metrics","Attributes",":","--","--","--","--","--","-","metrics",":","A","list","of","configured","metrics","for","task"]
docstr: Finds a metric by id
  
  Parameters
  ----------
  id:
      The metric id
  
  Returns
  -------
      Found metric if any, ``None`` otherwise
docstr_tok: ["Finds","a","metric","by","id","Parameters","--","--","--","--","--","id",":","The","metric","id","Returns","--","--","--","-","Found","metric","if","any",",","``","None","``","otherwise"]
code: def find_metric(
      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
  
file_path: argilla/src/argilla/server/services/metrics/models.py
imports: from typing import Any, ClassVar, Dict, Generic, Iterable, List, Optional, TypeVar, Union
  from argilla.server.pydantic_v1 import BaseModel, Field
  from argilla.server.services.search.model import ServiceRecordsQuery
  from argilla.server.services.tasks.commons import ServiceRecord
label_desc: Use image node_id 1 for calling the ServiceBaseTaskMetrics obj's underlying member method code with example usage: obj.find_metric(cls, id) and returns: metric, metric