code: def _add_deflection(position, observer, deflector, rmass):
      
      # Construct vector 'pq' from gravitating body to observed object and
      # construct vector 'pe' from gravitating body to observer.
  
      pq = observer + position - deflector
      pe = observer - deflector
  
      # Compute vector magnitudes and unit vectors.
  
      pmag = length_of(position)
      qmag = length_of(pq)
      emag = length_of(pe)
  
      phat = position / where(pmag, pmag, 1.0)  # where() avoids divide-by-zero
      qhat = pq / where(qmag, qmag, 1.0)
      ehat = pe / where(emag, emag, 1.0)
  
      # Compute dot products of vectors.
  
      pdotq = dots(phat, qhat)
      qdote = dots(qhat, ehat)
      edotp = dots(ehat, phat)
  
      # If gravitating body is observed object, or is on a straight line
      # toward or away from observed object to within 1 arcsec, deflection
      # is set to zero set 'pos2' equal to 'pos1'.
  
      make_no_correction = abs(edotp) > 0.99999999999
  
      # Compute scalar factors.
  
      fac1 = 2.0 * GS / (C * C * emag * AU_M * rmass)
      fac2 = 1.0 + qdote
  
      # Correct position vector.
  
      position += where(make_no_correction, 0.0,
                        fac1 * (pdotq * ehat - edotp * qhat) / fac2 * pmag)
docs: Correct a position vector for how one particular mass deflects light.
  
      Given the ICRS `position` [x,y,z] of an object (AU) together with
      the positions of an `observer` and a `deflector` of reciprocal mass
      `rmass`, this function updates `position` in-place to show how much
      the presence of the deflector will deflect the image of the object.