def polynomial_redshift(d):
    """
    Polynomial approximation of calculating redshift corresponding to a given
    distance.
    
    Parameters
    ----------
    d: float
        A luminosity distance, in Mpc.
        
    Returns
    -------
    z: float
        The redshift corresponding to the input distance.
    """
    
    #input type checking
    assert type(d) == float, 'd should be a float.'
    
    #sanity check: distance should not be negative
    assert d >= 0, 'The distance should be a positive number.'
    
    #polynomial approximation of redshift conversion
    z = 1.0832e-12*d**3 - 1.7022e-8*d**2 + 0.00021614*d
    
    return z