code: def register_scorer(metric):
      """Scorer register that can be used to add new scorer class."""
  
      def register_scorer_cls(cls):
          if metric in AVAILABLE_SCORERS.keys():
              raise ValueError(
                  "Cannot register duplicate scorer for metric ({})".format(
                      metric
                  )
              )
          if not issubclass(cls, Scorer):
              raise ValueError(
                  "scorer ({}: {}) must extend Scorer".format(
                      metric, cls.__name__
                  )
              )
          AVAILABLE_SCORERS[metric] = cls
          return cls
  
      return register_scorer_cls
  
imports: import os
  import importlib
  from .scorer import Scorer, build_scorers
label_desc: Use image node_id 2 for calling a global function with example usage: register_scorer(metric) and returns: register_scorer_cls, cls