code: def _protected_division(x1, x2):
      
      with np.errstate(divide='ignore', invalid='ignore'):
          return np.where(np.abs(x2) > 0.001, np.divide(x1, x2), 1.)
docs: Closure of division (x1/x2) for zero denominator.