'The redshift for this distance assuming its physical distance is
a luminosity distance.
Parameters
cosmology : ``Cosmology`` or `None`
The cosmology to assume for this calculation, or `None` to use the
current cosmology (see `astropy.cosmology` for details).
Returns
z : float
The redshift of this distance given the provided ``cosmology``.'

def compute_z(self, cosmology=None):

    if (cosmology is None):
        from ..cosmology import default_cosmology
        cosmology = default_cosmology.get()
    from ..cosmology import z_at_value
    return z_at_value(cosmology.luminosity_distance, self, ztol=1e-10)
