code: def get_redshift(self, dist):
          
          dist, input_is_array = ensurearray(dist)
          try:
              zs = self.nearby_d2z(dist)
          except TypeError:
              # interpolant hasn't been setup yet
              self.setup_interpolant()
              zs = self.nearby_d2z(dist)
          # if any points had red shifts beyond the nearby, will have nans;
          # replace using the faraway interpolation
          replacemask = numpy.isnan(zs)
          if replacemask.any():
              zs[replacemask] = self.faraway_d2z(dist[replacemask])
              replacemask = numpy.isnan(zs)
          # if we still have nans, means that some distances are beyond our
          # furthest default; fall back to using astropy
          if replacemask.any():
              # well... check that the distance is positive and finite first
              if not (dist > 0.).all() and numpy.isfinite(dist).all():
                  raise ValueError("distance must be finite and > 0")
              zs[replacemask] = _redshift(dist[replacemask],
                                          cosmology=self.cosmology)
          return formatreturn(zs, input_is_array)
docs: Returns the redshift for the given distance.