code: def get_distance_by_name(name: str) -> Distance:
      """
      Select a distance by name.
  
      Parameters
      ----------
      name : str
          A string defining the metric to get.
  
      Returns
      -------
      Distance
          The distance object.
      """
  
      if name in _SCALAR_DISTANCE_FUNCTIONS:
          warning(
              "You are using a scalar distance function. If you want to speed up the"
              " tracking process please consider using a vectorized distance function"
              f" such as {AVAILABLE_VECTORIZED_DISTANCES}."
          )
          distance = _SCALAR_DISTANCE_FUNCTIONS[name]
          distance_function = ScalarDistance(distance)
      elif name in _SCIPY_DISTANCE_FUNCTIONS:
          distance_function = ScipyDistance(name)
      elif name in _VECTORIZED_DISTANCE_FUNCTIONS:
          if name == "iou_opt":
              warning("iou_opt is deprecated, use iou instead")
          distance = _VECTORIZED_DISTANCE_FUNCTIONS[name]
          distance_function = VectorizedDistance(distance)
      else:
          raise ValueError(
              f"Invalid distance '{name}', expecting one of"
              f" {list(_SCALAR_DISTANCE_FUNCTIONS.keys()) + AVAILABLE_VECTORIZED_DISTANCES}"
          )
  
      return distance_function
  
imports: from abc import ABC, abstractmethod
  from functools import partial
  from logging import warning
  from typing import TYPE_CHECKING, Callable, List, Optional, Sequence, Union
  import numpy
  from scipy.spatial.distance import cdist
label_desc: Use image node_id 7 for calling a global function with example usage: get_distance_by_name(name) and returns: distance_function