def METHOD_NAME(self, *, part_dependencies: Optional[List[str]] = None):
    """Ensure the environment contains dependencies needed by the plugin.
    :param part_dependencies: A list of the parts this part depends on.
    :raises PluginEnvironmentValidationError: If the environment is invalid.
    """
    try:
        version_data = json.loads(self._execute("charm version --format json"))
        tool_name = "charm-tools"
        if not (
            tool_name in version_data
            and "version" in version_data[tool_name]
            and "git" in version_data[tool_name]
        ):
            raise PluginEnvironmentValidationError(
                part_name=self._part_name,
                reason=f"invalid charm tools version {version_data}",
            )
        tools_version = (
            f"{tool_name} {version_data[tool_name]['version']} "
            f"({version_data[tool_name]['git']})"
        )
        print(f"found {tools_version}")
    except ValueError as err:
        raise PluginEnvironmentValidationError(
            part_name=self._part_name,
            reason="invalid charm tools installed",
        ) from err
    except subprocess.CalledProcessError as err:
        if err.returncode != plugins.validator.COMMAND_NOT_FOUND:
            raise PluginEnvironmentValidationError(
                part_name=self._part_name,
                reason=f"charm tools failed with error code {err.returncode}",
            ) from err
        if part_dependencies is None or "charm-tools" not in part_dependencies:
            raise PluginEnvironmentValidationError(
                part_name=self._part_name,
                reason=(
                    f"charm tool not found and part {self._part_name!r} "
                    f"does not depend on a part named 'charm-tools'"
                ),
            ) from err