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

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

    Parameters
    ----------
    richness : ndarray or float
        Cluster richness value(s).
    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 mass(es) in units of solar masses, of same type as
        richness.

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