def _create_var_from_spec(spec):
    """
    This helper function is used for creating PyMIL Var/ListVar from the proto spec.
    Mainly used for the construction of the control flow ops.
    """
    assert isinstance(spec, proto.MIL_pb2.NamedValueType)
    sym_type = proto_to_types(spec.type)
    name = spec.name
    if types.is_list(sym_type):
        var = ListVar(
            name,
            elem_type=sym_type.T[0],
            init_length=sym_type.T[1],
            dynamic_length=sym_type.T[2])
    else:
        var = Var(name, sym_type, None, op=None, op_output_idx=None)
    return var

    This helper function is used for creating PyMIL Var/ListVar from the proto spec.
    Mainly used for the construction of the control flow ops.
    
coremltools/converters/mil/frontend/milproto/load.py