code: def roots_in_unit_interval(coeffs):
      r
      all_roots = polynomial.polyroots(coeffs)
      # Only keep roots inside or very near to the unit interval.
      all_roots = all_roots[
          (_UNIT_INTERVAL_WIGGLE_START < all_roots.real)
          & (all_roots.real < _UNIT_INTERVAL_WIGGLE_END)
      ]
      # Only keep roots with very small imaginary part. (Really only
      # keep the real parts.)
      real_inds = np.abs(all_roots.imag) < _IMAGINARY_WIGGLE
      return all_roots[real_inds].real
docs: r"""Compute roots of a polynomial in the unit interval.
  
      Args:
          coeffs (numpy.ndarray): A 1D array (size ``d + 1``) of coefficients in
              monomial / power basis.
  
      Returns:
          numpy.ndarray: ``N``-array of real values in :math:`\left[0, 1\right]`.