<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def uninstall(ctx, plugin):
 """ Uninstall the given plugin. """

    ensure_inside_venv(ctx)

    if plugin not in get_installed_plugins():
        echo_error("Plugin {} does not seem to be installed.".format(plugin))
        sys.exit(1)

    plugin_name = get_plugin_name(plugin)
    try:
        run_command([sys.executable, '-m', 'pip', 'uninstall', '-y',
                     plugin_name])
    except subprocess.CalledProcessError as e:
        echo_error(
            "Error when trying to uninstall plugin {}. Error message "
            "was:\n\n{}".format(plugin, e.output.decode())
        )
        sys.exit(1)
    else:
        echo_success("Plugin {} uninstalled successfully.".format(plugin))