code: def _parse_config(pred_field, gt_field, method, **kwargs):
      if method is None:
          method = fo.evaluation_config.default_segmentation_backend
  
      if inspect.isclass(method):
          return method(pred_field, gt_field, **kwargs)
  
      backends = fo.evaluation_config.segmentation_backends
  
      if method not in backends:
          raise ValueError(
              "Unsupported segmentation evaluation method '%s'. The available "
              "methods are %s" % (method, sorted(backends.keys()))
          )
  
      params = deepcopy(backends[method])
  
      config_cls = kwargs.pop("config_cls", None)
  
      if config_cls is None:
          config_cls = params.pop("config_cls", None)
  
      if config_cls is None:
          raise ValueError(
              "Segmentation evaluation method '%s' has no `config_cls`"
              % method
          )
  
      if etau.is_str(config_cls):
          config_cls = etau.get_class(config_cls)
  
      params.update(**kwargs)
      return config_cls(pred_field, gt_field, **params)
  
imports: from copy import deepcopy
  import logging
  import inspect
  import warnings
  import numpy
  import sklearn.metrics
  import eta.core.image
  import eta.core.utils
  import fiftyone
  import fiftyone.core.evaluation
  import fiftyone.core.fields
  import fiftyone.core.labels
  import fiftyone.core.utils
  import fiftyone.core.validation
  from .base import BaseEvaluationResults
label_desc: Use image node_id 2 for calling a global function with example usage: _parse_config(pred_field, gt_field, method) and returns: config_cls, method