def _broadcast_weights(da_data, da_weight, keep_attrs=False):
    """broadcasts da_weights to the same shape as da_data and     masks the same missing values"""
    da_data = da_data.copy()
    ones = da_data * 0 + 1
    weights_expanded = ones * da_weight
    if keep_attrs:
        weights_expanded.attrs = da_data.attrs
    return weights_expanded
