code: def sanitize(lat, ell: Ellipsoid | None, deg: bool) -> tuple:
      if ell is None:
          ell = Ellipsoid.from_name("wgs84")
  
      try:
          lat = asarray(lat)
      except NameError:
          pass
  
      if deg:
          lat = radians(lat)
  
      try:
          if (abs(lat) > pi / 2).any():
              raise ValueError("-pi/2 <= latitude <= pi/2")
      except AttributeError:
          if abs(lat) > pi / 2:
              raise ValueError("-pi/2 <= latitude <= pi/2")
  
      return lat, ell
  
file_path: pymap3d/src/pymap3d/utils.py
imports: from __future__ import annotations
  from math import pi
  from .ellipsoid import Ellipsoid
  from .mathfun import atan2, cos, hypot, radians, sin
label_desc: Use image node_id 5 for calling a global function with example usage: sanitize(lat, ell, deg) and returns: lat,  ell