<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def install(modal):
 """Perform first time install"""


    if _state.get("installed"):
        sys.stdout.write("Already installed, uninstalling..\n")
        uninstall()

    use_threaded_wrapper = not modal

    install_callbacks()
    install_host(use_threaded_wrapper)

    _state["installed"] = True