def bias(mass, z, h=h, Om_M=Om_M, Om_L=Om_L):
    """Calculate halo bias, from Seljak & Warren 2004.

    Parameters
    ----------
    mass : ndarray or float
        Halo mass to calculate bias for.
    z : ndarray or float
        Halo z, same type and size as mass.
    h : float, optional
        Hubble parameter, defaults to astropy.cosmology.Planck13.h
    Om_M : float, optional
        Fractional matter density, defaults to
        astropy.cosmology.Planck13.Om0
    Om_L : float, optional
        Fractional dark energy density, defaults to 1-Om_M.

    Returns
    ----------
    ndarray or float
        Returns the halo bias, of same type and size as input mass_halo and
        z_halo. Calculated according to Seljak & Warren 2004 for z = 0.
        For halo z > 0, the non-linear mass is adjusted using the input
        cosmological parameters.

    References
    ----------
    Based on fitting formula derived from simulations in:

    U. Seljak and M.S. Warren, "Large-scale bias and stochasticity of
    haloes and dark matter," Monthly Notices of the Royal Astronomical
    Society, Volume 355, Issue 1, pp. 129-136 (2004).
    """
    M_nl_0 = 8.73 / h * 10.0 ** 12.0
    M_nl = M_nl_0 * (Om_M + Om_L / (1.0 + z) ** 3.0)
    x = mass / M_nl
    b = 0.53 + 0.39 * x ** 0.45 + 0.13 / (40.0 * x + 1.0) + 0.0005 * x ** 1.5
    return b
