def record_type(values):
    """
    Creates a record type field.

    These serve as the header field on records, identifying them.

    Usually this field can be only an specific value, but sometimes a small
    range of codes is allowed. This is specified by the 'values' parameter.

    While it is possible to set this field as optional, it is expected to be
    compulsory.

    :param values: allowed record type codes
    :return: grammar for the record type field
    """
    field = basic.lookup(values, name='Record Type (one of %s)' % values)

    return field.setResultsName('record_type')