<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def build_and_install_wheel(python):
 """Build a binary distribution wheel and install it"""

    dist_type = "bdist_wheel" if not SDIST else "sdist"
    return_code = run_command("{} setup.py {}".format(python, dist_type))
    if return_code != 0:
        print("Building and installing wheel failed.")
        exit(return_code)
    # Check if an artifact exists
    assert check_wheel_existence()
    print("Wheel file exists.")
    # Install the wheel file
    wheel = [file for file in os.listdir("dist") if file.endswith((".whl", ".tar.gz"))][0]
    wheel = os.path.join("dist", wheel)
    print("Wheel file:", wheel)
    return_code = run_command("{} -m pip install --ignore-installed {}".format(python, wheel))
    if return_code != 0:
        print("Installation of wheel failed.")
        exit(return_code)
    print("Wheel file installed.")