def mass_to_richness(mass, norm=2.7e13, slope=1.4):
    """Calculate richness from mass.

    Mass-richness relation assumed is:
    mass = norm * (richness / 20) ^ slope.

    Parameters
    ----------
    mass : ndarray or float
        Cluster mass value(s) in units of solar masses.
    norm : float, optional
        Normalization of mass-richness relation in units of solar masses,
        defaults to 2.7e13.
    slope : float, optional
        Slope of mass-richness relation in units of solar masses, defaults
        to 1.4.

    Returns
    ----------
    ndarray or float
        Cluster richness(es), of same type as mass.

    See Also
    ----------
    richness_to_mass : The inverse of this function.
    """
    richness = 20. * (mass / norm)**(1. / slope)
    return richness