code: def get_cost_fn(cost_fn_type: CostFunctionType):
      """Retrieves a cost function corresponding to `cost_fn_type`."""
  
      if cost_fn_type == cost_fn_type.HAMMING:
          return hamming_distance
      else:
          raise RuntimeError("invalid cost type provideo")
  
file_path: pytext/pytext/loss/structured_loss.py
imports: from enum import Enum
  from typing import Union
  import torch
  import torch.nn.functional
  from pytext.config import ConfigBase
  from pytext.config.component import create_loss
  from .loss import HingeLoss, Loss, NLLLoss
label_desc: Use image node_id 2 for calling a global function with example usage: get_cost_fn(cost_fn_type) and returns: hamming_distance