# Buggy code
def do_clean(ctx, three=None, python=None, dry_run=False, bare=False, verbose=False):
    # Ensure that virtualenv is available.
    ensure_project(three=three, python=python, validate=False)

    ensure_lockfile()

    installed_packages = (
        delegator.run("{0} freeze".format(which("pip"))).out.strip().split("\n")
    )

    installed_package_names = []
    for installed in installed_packages:
        r = get_requirement(installed, verbose=verbose)

        # Ignore editable installations.
        if not r.editable:
            installed_package_names.append(r.name.lower())
        else:
            if verbose:
                click.echo("Ignoring {0}.".format(repr(r.name)), err=True)

    # Remove known "bad packages" from the list.
    for bad_package in BAD_PACKAGES:
        if bad_package in installed_package_names:
            if verbose:
                click.echo("Ignoring {0}.".format(repr(bad_package)), err=True)
            del installed_package_names[installed_package_names.index(bad_package)]

    # Intelligently detect if --dev should be used or not.
    develop = [k.lower() for k in project.lockfile_content["develop"].keys()]
    default = [k.lower() for k in project.lockfile_content["default"].keys()]

    for used_package in set(develop + default):
        if used_package in installed_package_names:
            del installed_package_names[installed_package_names.index(used_package)]

    failure = False
    for apparent_bad_package in installed_package_names:
        if dry_run:
            click.echo(apparent_bad_package)
        else:
            click.echo(
                crayons.white(
                    "Uninstalling {0}…".format(repr(apparent_bad_package)), bold=True
                )
            )

            # Uninstall the package.
            c = delegator.run(
                "{0} uninstall {1} -y".format(which("pip"), apparent_bad_package)
            )
            if c.return_code != 0:
                failure = True

    sys.exit(int(failure))


# Traceback (TypeError)
$ pipenv clean
Traceback (most recent call last):
File "/usr/local/bin/pipenv", line 11, in <module>
load_entry_point('pipenv==11.1.3', 'console_scripts', 'pipenv')()
File "/usr/local/lib/python3.6/dist-packages/pipenv/vendor/click/core.py", line 722, in __call__
return self.main(*args, **kwargs)
File "/usr/local/lib/python3.6/dist-packages/pipenv/vendor/click/core.py", line 697, in main
rv = self.invoke(ctx)
File "/usr/local/lib/python3.6/dist-packages/pipenv/vendor/click/core.py", line 1066, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/usr/local/lib/python3.6/dist-packages/pipenv/vendor/click/core.py", line 895, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/local/lib/python3.6/dist-packages/pipenv/vendor/click/core.py", line 535, in invoke
return callback(*args, **kwargs)
File "/usr/local/lib/python3.6/dist-packages/pipenv/vendor/click/decorators.py", line 17, in new_func
return f(get_current_context(), *args, **kwargs)
File "/usr/local/lib/python3.6/dist-packages/pipenv/cli.py", line 449, in clean
ctx=ctx, three=three, python=python, dry_run=dry_run, verbose=verbose
File "/usr/local/lib/python3.6/dist-packages/pipenv/core.py", line 2432, in do_clean
r = get_requirement(installed, verbose=verbose)
TypeError: get_requirement() got an unexpected keyword argument 'verbose'

# Fixed code
def do_clean(ctx, three=None, python=None, dry_run=False, bare=False, verbose=False):
    # Ensure that virtualenv is available.
    ensure_project(three=three, python=python, validate=False)

    ensure_lockfile()

    installed_packages = (
        delegator.run("{0} freeze".format(which("pip"))).out.strip().split("\n")
    )

    installed_package_names = []
    for installed in installed_packages:
        r = get_requirement(installed)

        # Ignore editable installations.
        if not r.editable:
            installed_package_names.append(r.name.lower())
        else:
            if verbose:
                click.echo("Ignoring {0}.".format(repr(r.name)), err=True)

    # Remove known "bad packages" from the list.
    for bad_package in BAD_PACKAGES:
        if bad_package in installed_package_names:
            if verbose:
                click.echo("Ignoring {0}.".format(repr(bad_package)), err=True)
            del installed_package_names[installed_package_names.index(bad_package)]

    # Intelligently detect if --dev should be used or not.
    develop = [k.lower() for k in project.lockfile_content["develop"].keys()]
    default = [k.lower() for k in project.lockfile_content["default"].keys()]

    for used_package in set(develop + default):
        if used_package in installed_package_names:
            del installed_package_names[installed_package_names.index(used_package)]

    failure = False
    for apparent_bad_package in installed_package_names:
        if dry_run:
            click.echo(apparent_bad_package)
        else:
            click.echo(
                crayons.white(
                    "Uninstalling {0}…".format(repr(apparent_bad_package)), bold=True
                )
            )

            # Uninstall the package.
            c = delegator.run(
                "{0} uninstall {1} -y".format(which("pip"), apparent_bad_package)
            )
            if c.return_code != 0:
                failure = True

    sys.exit(int(failure))