def spheroid(eta=0):
    """
    Calculate value of spheroidal function used for gridding convolution function at a given value eta

    The rational approximation for this function is presented in F.R. Schwab's "Optimal Gridding of Visibility Data in Radio Interferometry" in Indirect Imaging: Measurement and Processing for Indirect Imaging, 1984
    m=5, alpha = 1

    Parameter
    _________
    eta: float between -1 and 1 

    Returns
    _______
    out: float. Value of spheroidal function at eta
    
    """
    n = eta ** 2 - 1 ** 2
    if abs(eta) < 1.0000000000001:
        return (0.01624782 * pow(n, 6) + -0.05350728 * pow(n, 5) + 
            0.1464354 * pow(n, 4) + -0.2347118 * pow(n, 3) + 0.2180684 *
            pow(n, 2) + -0.09858686 * n + 0.01466325) / (0.2177793 * n + 1)
    else:
        return 1e+30
