code: def final_spin_from_f0_tau(f0, tau, l=2, m=2):
      
      f0, tau, input_is_array = ensurearray(f0, tau)
      # from Berti et al. 2006
      a, b, c = _berti_spin_constants[l,m]
      origshape = f0.shape
      # flatten inputs for storing results
      f0 = f0.ravel()
      tau = tau.ravel()
      spins = numpy.zeros(f0.size)
      for ii in range(spins.size):
          Q = f0[ii] * tau[ii] * numpy.pi
          try:
              s = 1. - ((Q-a)/b)**(1./c)
          except ValueError:
              s = numpy.nan
          spins[ii] = s
      spins = spins.reshape(origshape)
      return formatreturn(spins, input_is_array)
docs: Returns the final spin based on the given frequency and damping time.
  
      .. note::
          Currently, only l = m = 2 is supported. Any other indices will raise
          a ``KeyError``.
  
      Parameters
      ----------
      f0 : float or array
          Frequency of the QNM (in Hz).
      tau : float or array
          Damping time of the QNM (in seconds).
      l : int, optional
          l-index of the harmonic. Default is 2.
      m : int, optional
          m-index of the harmonic. Default is 2.
  
      Returns
      -------
      float or array
          The spin of the final black hole. If the combination of frequency
          and damping times give an unphysical result, ``numpy.nan`` will be
          returned.