def _fit_quality(column, weights, constraint):
    """
    Calculate quality of fit metric for a column of the frequency table.
    (The 𝛿 parameter described in the IPU paper.)

    Parameters
    ----------
    column : 1D array
        Non-zero elements of a column of a frequency table.
        Must have the same length as `weights`.
    weights : 1D array
        Weights corresponding to the household rows in `column`.
        Must have the same length as `column`.
    constraint : float
        Target marginal constraint for this column.

    Returns
    -------
    quality : float

    """
    return abs((column * weights).sum() - constraint) / constraint