def _consolidate(data_type):
    """Enforce the structure of the data type.

    Specifically, ensure that if a field is defined as a generic tuple, then it
    will be converted into an instance of `Field`.
    """
    if isinstance(data_type, _ATOMIC):
        out = data_type
    elif isinstance(data_type, Array):
        element_type = _consolidate(data_type.element_type)
        out = data_type._replace(element_type=element_type)
    elif isinstance(data_type, Structure):
        fields = tuple(
            Field(*(_consolidate(field[i]) if i == _FIELD_TYPE_IDX
                    else field[i]
                    for i in _range(len(field))))
            for field in data_type.fields)
        out = data_type._replace(fields=fields)

    return out
Enforce the structure of the data type.

    Specifically, ensure that if a field is defined as a generic tuple, then it
    will be converted into an instance of `Field`.