code: def _handle_angle_input(
      x, dtype: torch.dtype, device: Optional[Device], name: str
  ) -> torch.Tensor:
      """
      Helper function for building a rotation function using angles.
      The output is always of shape (N,).
  
      The input can be one of:
          - Torch tensor of shape (N,)
          - Python scalar
          - Torch scalar
      """
      device_ = get_device(x, device)
      if torch.is_tensor(x) and x.dim() > 1:
          msg = "Expected tensor of shape (N,); got %r (in %s)"
          raise ValueError(msg % (x.shape, name))
      else:
          return _handle_coord(x, dtype, device_)
  
imports: import math
  import os
  import warnings
  from typing import List, Optional, Union
  import torch
  from ..common.datatypes import Device, get_device, make_device
  from ..common.workaround import _safe_det_3x3
  from .rotation_conversions import _axis_angle_rotation
  from .se3 import se3_log_map
label_desc: Use image node_id 3 for calling a global function with example usage: _handle_angle_input(x, dtype, device, name) and returns: _handle_coord