def set_transform_interface_params(
    spec,
    input_features,
    output_features,
    are_optional=False,
    training_features=None,
    array_datatype=None,
):
    """
    Common utilities to set transform interface params.
    """
    if array_datatype is None:
        array_datatype = proto.Model_pb2.ArrayFeatureType.DOUBLE

    input_features = _fm.process_or_validate_features(input_features)
    output_features = _fm.process_or_validate_features(output_features)

    # Add input and output features
    for (fname, ftype) in input_features:
        input_ = spec.description.input.add()
        input_.name = fname
        datatypes._set_datatype(input_.type, ftype, array_datatype=array_datatype)
        if are_optional:
            input_.type.isOptional = are_optional

    for (fname, ftype) in output_features:
        output_ = spec.description.output.add()
        output_.name = fname
        datatypes._set_datatype(output_.type, ftype, array_datatype=array_datatype)

    # Add training features
    if training_features is not None:
        spec = set_training_features(spec, training_features)

    return spec

    Common utilities to set transform interface params.
    
coremltools/models/_interface_management.py