def _list(env, key, more, loader, _all=False, output=None):
    """Lists all user defined config values
    and if `--all` is passed it also shows dynaconf internal variables.
    """
    if env:
        env = env.strip()
    if key:
        key = key.strip()
    if loader:
        loader = loader.strip()

    if env:
        settings.setenv(env)

    cur_env = settings.current_env.lower()

    click.echo(
        click.style(
            "Working in %s environment " % cur_env,
            bold=True,
            bg="blue",
            fg="bright_black",
        )
    )

    if not loader:
        data = settings.as_dict(env=env, internal=_all)
    else:
        identifier = "{}_{}".format(loader, cur_env)
        data = settings._loaded_by_loaders.get(identifier, {})
        data = data or settings._loaded_by_loaders.get(loader, {})

    # remove to avoid displaying twice
    data.pop("SETTINGS_MODULE", None)

    def color(_k):
        if _k in dir(default_settings):
            return "blue"
        return "green"

    if not key:
        datalines = "\n".join(
            "%s: %s"
            % (click.style(k, bg=color(k), fg="white"), pprint.pformat(v))
            for k, v in data.items()
        )
        (click.echo_via_pager if more else click.echo)(datalines)
        if output:
            with open(output, "w") as output_file:
                json.dump({cur_env: data}, output_file)
    else:
        key = key.upper()
        value = data.get(key)
        if not value:
            click.echo(click.style("Key not found", bg="red", fg="white"))
            return
        click.echo(
            "%s: %s"
            % (
                click.style(key.upper(), bg=color(key), fg="white"),
                pprint.pformat(value),
            )
        )
        if output:
            with open(output, "w") as output_file:
                json.dump({cur_env: {key.upper(): value}}, output_file)

    if env:
        settings.setenv()
Lists all user defined config values
    and if `--all` is passed it also shows dynaconf internal variables.