code: def load_metric_handler(writer):
      from fate.components.core.component_desc._metric import (
          ComponentMetricsFileHandler,
          ComponentMetricsRestfulHandler,
          JsonMetricFileWriter,
          JsonMetricRestfulWriter,
      )
  
      if isinstance(writer, JsonMetricRestfulWriter):
          return ComponentMetricsRestfulHandler(writer=writer)
      elif isinstance(writer, JsonMetricFileWriter):
          return ComponentMetricsFileHandler(writer=writer)
      else:
          raise ValueError(f"writer `{writer}` not allowed")
  
label_desc: Use image node_id 1 for calling a global function with example usage: load_metric_handler(writer) and returns: ComponentMetricsRestfulHandler, ComponentMetricsFileHandler