code: def preprocess_keypoints(
      input: Union[Tensor, Keypoints]
  ) -> Keypoints:
      """Preprocess input keypoints."""
      # TODO: We may allow list here.
      if isinstance(input, Tensor):
          if not (
              len(input.shape) == 3
              and input.shape[1:] == torch.Size([2])
          ):
              raise RuntimeError(
                  f"Only BxNx2 tensor is supported. Got {input.shape}."
              )
          input = Keypoints(input, False)
      if isinstance(input, Keypoints):
          raise RuntimeError(
              f"Expect `Keypoints` type. Got {type(input)}."
          )
      return input
  
imports: from functools import wraps
  from typing import Any, Callable, Dict, List, Optional, Tuple, Union
  import torch
  from torch.distributions import Beta, Uniform
  from kornia.core import Tensor, as_tensor
  from kornia.geometry.boxes import Boxes
  from kornia.geometry.keypoints import Keypoints
  from kornia.utils import _extract_device_dtype
label_desc: Use image node_id 19 for calling a global function with example usage: preprocess_keypoints(input) and returns: input