code: def sphere_distance(pts1, pts2, radius=None, check_radius=True):
      """Distance across sphere surface between `pts1` and `pts2`
  
      Parameters
      ----------
      pts1 : (N,R) or (R,) array_like
         where N is the number of points and R is the number of
         coordinates defining a point (``R==3`` for 3D)
      pts2 : (N,R) or (R,) array_like
         where N is the number of points and R is the number of
         coordinates defining a point (``R==3`` for 3D).  It should be
         possible to broadcast `pts1` against `pts2`
      radius : None or float, optional
         Radius of sphere.  Default is to work out radius from mean of the
         length of each point vector
      check_radius : bool, optional
         If True, check if the points are on the sphere surface - i.e
         check if the vector lengths in `pts1` and `pts2` are close to
         `radius`.  Default is True.
  
      Returns
      -------
      d : (N,) or (0,) array
         Distances between corresponding points in `pts1` and `pts2`
         across the spherical surface, i.e. the great circle distance
  
      See Also
      --------
      cart_distance : cartesian distance between points
      vector_cosine : cosine of angle between vectors
  
      Examples
      --------
      >>> print('%.4f' % sphere_distance([0,1],[1,0]))
      1.5708
      >>> print('%.4f' % sphere_distance([0,3],[3,0]))
      4.7124
      """
      pts1 = np.asarray(pts1)
      pts2 = np.asarray(pts2)
      lens1 = np.sqrt(np.sum(pts1**2, axis=-1))
      lens2 = np.sqrt(np.sum(pts2**2, axis=-1))
      if radius is None:
          radius = (np.mean(lens1) + np.mean(lens2)) / 2.0
      if check_radius:
          if not (
              np.allclose(radius, lens1) and np.allclose(radius, lens2)
          ):
              raise ValueError("Radii do not match sphere surface")
      # Get angle with vector cosine
      dots = np.inner(pts1, pts2)
      lens = lens1 * lens2
      angle_cos = np.arccos(dots / lens)
      return angle_cos * radius
  
imports: import itertools
  import math
  import numpy
  import numpy.linalg
label_desc: Use image node_id 8 for calling a global function with example usage: sphere_distance(pts1, pts2, radius, check_radius) and returns: unknown