def METHOD_NAME(dir, runas=None, env=None):
    """
    .. versionadded:: 2017.7.0
    Remove extraneous local Bower packages, i.e. those not referenced in bower.json
    dir
        The directory whose packages will be pruned
    runas
        The user to run Bower with
    env
        Environment variables to set when invoking Bower. Uses the same ``env``
        format as the :py:func:`cmd.run <salt.modules.cmdmod.run>` execution
        function.
    CLI Example:
    .. code-block:: bash
        salt '*' bower.prune /path/to/project
    """
    _check_valid_version()
    cmd = _construct_bower_command("prune")
    result = __salt__["cmd.run_all"](
        cmd, cwd=dir, runas=runas, env=env, python_shell=False
    )
    if result["retcode"] != 0:
        raise CommandExecutionError(result["stderr"])
    # Bower returns an empty dictionary if nothing was pruned
    return salt.utils.json.loads(result["stdout"])