Make get_weighted_mean more flexible/modular.