from typing import Dict


def _create_stats_dict_from_values(
    total_sum_w: float, total_sum_w2: float, total_sum_wx: float, total_sum_wx2: float
) -> Dict[str, float]:
    """Create a statistics dictionary from the provided set of values.

    This is particularly useful for ensuring that the dictionary values are created uniformly.

    Args:
        total_sum_w: Total sum of the weights (ie. the frequencies).
        total_sum_w2: Total sum of the weights squared (ie. sum of Sumw2 array).
        total_sum_wx: Total sum of weights * x.
        total_sum_wx2: Total sum of weights * x * x.
    Returns:
        Statistics dict suitable for storing in the metadata.
    """
    return {
        "_total_sum_w": total_sum_w,
        "_total_sum_w2": total_sum_w2,
        "_total_sum_wx": total_sum_wx,
        "_total_sum_wx2": total_sum_wx2,
    }