def get_roundtrip_mlmodel(mlmodel):
    """
    This utility function does the following roundtrip conversion:

    mlprogram proto -> pymil program -> mlprogram model
    """
    pymil_prog = get_pymil_prog_from_mlmodel(mlmodel)

    # convert the pymil program to mlmodel
    model_spec = mlmodel.get_spec()
    roundtripped_mlmodel = mil_convert(
        pymil_prog,
        convert_to="mlprogram",
        convert_from="milinternal",
        compute_units=mlmodel.compute_unit,
        model_description=model_spec.description,
        specification_version=model_spec.specificationVersion,
    )

    # set MIL program attributes
    build_info = _get_metadata_from_mlmodel(mlmodel)
    roundtripped_mlmodel._set_build_info_mil_attributes(build_info)
    return roundtripped_mlmodel

    This utility function does the following roundtrip conversion:

    mlprogram proto -> pymil program -> mlprogram model
    
coremltools/converters/mil/frontend/milproto/test_load.py