def METHOD_NAME(gloo_is_built, mpi_is_built):
    """
    Patches the gloo_built and mpi_built methods called from horovod.runner.run.run_controller
    to return the given booleans. That method is used by horovod.spark.run to determine which
    controller to use. Patching these methods allows to test horovod.spark.run without an MPI
    implementation to be installed.
    :param gloo_is_built: boolean returned by gloo_built
    :param mpi_is_built: boolean returned by mpi_built
    :return: mocked gloo_built and mpi_built methods
    """
    with mock.patch("horovod.runner.launch.gloo_built", return_value=gloo_is_built) as g:
        with mock.patch("horovod.runner.launch.mpi_built", return_value=mpi_is_built) as m:
            yield g, m