def _check_design_matrices(y, X):
    """Check design matrices have required attributes."""

    if not hasattr(y.design_info, 'terms') or y.design_info.terms is None:
        raise ValueError(
            'Outcomes matrix must have terms attribute')

    if not hasattr(X.design_info, 'terms') or X.design_info.terms is None:
        raise ValueError(
            'Design matrix must have terms attribute')

    return y, X