def load_mil_proto(program_spec, specification_version, file_weights_dir=""):
    """
    Load in-memory Proto specification of MILSpec.Program(.Proto) object to PyMIL
    """
    if not isinstance(program_spec, proto.MIL_pb2.Program):
        raise TypeError("Invalid Program spec object")

    if program_spec.docString:
        raise NotImplementedError("Docstring would be lost in the process")

    if program_spec.version != 1:
        raise ValueError("Invalid program version")

    context = TranscriptionContext(file_weights_dir)
    pymil_program = mil.Program()
    for func_name, func_spec in program_spec.functions.items():
        pymil_program.add_function(
            func_name, _load_function(context, func_spec, specification_version)
        )

    _load_program_spec_attributes(context, program_spec, pymil_program)

    return pymil_program

    Load in-memory Proto specification of MILSpec.Program(.Proto) object to PyMIL
    
coremltools/converters/mil/frontend/milproto/load.py