code: def get_code_to_measure_table(spacing, device=None):
      """
      returns a table mapping neighbourhood code to the surface area or contour length.
  
      Args:
          spacing: a sequence of 2 or 3 numbers, indicating the spacing in the spatial dimensions.
          device: device to put the table on.
      """
      spatial_dims = len(spacing)
      spacing = ensure_tuple_rep(
          spacing, look_up_option(spatial_dims, (2, 3))
      )
      if spatial_dims == 2:
          return create_table_neighbour_code_to_contour_length(
              spacing, device
          )
      return create_table_neighbour_code_to_surface_area(
          spacing, device
      )
  
imports: from __future__ import annotations
  import warnings
  from functools import lru_cache, partial
  from types import ModuleType
  from typing import Any, Iterable, Sequence
  import numpy
  import torch
  from monai.config import NdarrayOrTensor, NdarrayTensor
  from monai.transforms.croppad.dictionary import CropForegroundD
  from monai.transforms.utils import distance_transform_edt
  from monai.utils import MetricReduction, convert_to_cupy, convert_to_dst_type, convert_to_numpy, convert_to_tensor, deprecated_arg, deprecated_arg_default, ensure_tuple_rep, look_up_option, optional_import
label_desc: Use image node_id 12 for calling a global function with example usage: get_code_to_measure_table(spacing, device) and returns: create_table_neighbour_code_to_surface_area, create_table_neighbour_code_to_contour_length