def get_magnitude_scaling(C, mag):
    """
    Returns the magnitude scaling term
    """
    d_m = mag - CONSTANTS["Mh"]
    return np.where(mag <= CONSTANTS["Mh"],
                    C["e1"] + C["b1"] * d_m + C["b2"] * d_m ** 2.0,
                    C["e1"] + C["b3"] * d_m)