code: def gfrefn(t1, t2, s1, s2):
      
      t1 = ctypes.c_double(t1)
      t2 = ctypes.c_double(t2)
      s1 = ctypes.c_int(s1)
      s2 = ctypes.c_int(s2)
      t = ctypes.c_double()
      libspice.gfrefn_c(t1, t2, s1, s2, ctypes.byref(t))
      return t.value
docs: For those times when we can't do better, we use a bisection
      method to find the next time at which to test for state change.
  
      http://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/gfrefn_c.html
  
      :param t1: One of two values bracketing a state change.
      :type t1: float
      :param t2: The other value that brackets a state change.
      :type t2: float
      :param s1: State at t1.
      :type s1: bool
      :param s2: State at t2.
      :type s2: bool
      :return: New value at which to check for transition.
      :rtype: float