code: def convert_decomposable_metric_to_object(
      metric, names, is_epoch_metric=False
  ):
      if (
          isinstance(metric, nn.Module)
          and hasattr(metric, "compute")
          and (not is_epoch_metric or hasattr(metric, "update"))
          and hasattr(metric, "reset")
      ):
          return metric
      return DecomposableMetric(metric, names)
  
file_path: poutyne/poutyne/framework/metrics/decomposable.py
imports: from typing import Iterable, Mapping
  import numpy
  import torch
  import torch.nn
  from poutyne.framework.metrics.base import Metric
  from poutyne.utils import get_batch_size
label_desc: Use image node_id 1 for calling a global function with example usage: convert_decomposable_metric_to_object(metric, names, is_epoch_metric) and returns: DecomposableMetric, metric