def inspect(
    key, env, format, new_first, history_limit, _all, report_mode, verbose
):  # pragma: no cover
    """
    Inspect the loading history of the given settings instance.

    Filters by key and environment, otherwise shows all.
    """

    if report_mode == "debug":
        print_debug_info(
            settings,
            dumper=format,
            verbosity=verbose,
            key=key,
        )
        click.echo()
    elif report_mode == "inspect":
        try:
            inspect_settings(
                settings,
                key=key,
                env=env or None,
                dumper=format,
                new_first=new_first,
                include_internal=_all,
                history_limit=history_limit,
                print_report=True,
            )
            click.echo()
        except (KeyNotFoundError, EnvNotFoundError, OutputFormatError) as err:
            click.echo(err)
            sys.exit(1)
    else:
        click.echo("Invalid report mode")
        sys.exit(1)

    Inspect the loading history of the given settings instance.

    Filters by key and environment, otherwise shows all.
    
dynaconf/cli.py