def METHOD_NAME(code_set: _CodeSet, fields: typing.List[_Field]) -> model.Enumeration:
    primary_fields = [field for field in fields if code_set.id_ == field.id_]
    primary_field = primary_fields[0]
    secondary_fields = sorted([field for field in fields if code_set.id_ != field.id_],
            key=lambda field: int(field.id_))
    return model.Enumeration(primary_field=_make_field(primary_field),
            secondary_fields=[_make_field(secondary_field) for secondary_field in secondary_fields],
                type_=_make_type(primary_field, code_set), values=_make_values(code_set))