def METHOD_NAME(
    self, image, root_dir, config, *args, generator_dir=None, generator_args=None
):
    """Executes artman command in the artman container.
    Args:
        image:
            The Docker image for artman.
        root_dir:
            The input directory that will be mounted to artman docker
            container as local googleapis directory.
        config:
            Path to artman configuration YAML file.
        *args:
            Arguments to artman that follow ``generate``. Defines which
            artifacts to generate.
        generator_dir (Optional[str]):
            Path to local gapic-generator directory to use for generation.
            By default, the latest version of gapic-generator will be used.
        generator_args (Optional[List[str]]):
            Additional arguments to pass to the gapic generator, such as
            ``--dev_samples``.
    Returns:
        The output directory with artman-generated files.
    """
    container_name = "artman-docker"
    output_dir = root_dir / "artman-genfiles"
    additional_flags = []
    if generator_args:
        additional_flags.append(
            "--generator-args='{}'".format(" ".join(generator_args))
        )
    docker_cmd = ["docker", "run", "--name", container_name, "--rm", "-i"]
    # Environment variables
    docker_cmd.extend(
        [
            "-e",
            f"HOST_USER_ID={os.getuid()}",
            "-e",
            f"HOST_GROUP_ID={os.getgid()}",
            "-e",
            "RUNNING_IN_ARTMAN_DOCKER=True",
        ]
    )
    # Local directories to mount as volumes (and set working directory -w)
    docker_cmd.extend(
        [
            "-v",
            f"{root_dir}:{root_dir}",
            "-v",
            f"{output_dir}:{output_dir}",
            "-w",
            root_dir,
        ]
    )
    # Use local copy of GAPIC generator to generate, if path provided
    if generator_dir:
        docker_cmd.extend(["-v", f"{generator_dir}:/toolkit"])
    # Run /bin/bash in the image and then provide the shell command to run
    docker_cmd.extend([image, "/bin/bash", "-c"])
    artman_command = " ".join(
        map(
            str,
            ["artman", "--local", "--config", config]
            + additional_flags
            + ["generate"]
            + list(args),
        )
    )
    cmd = docker_cmd + [artman_command]
    shell.METHOD_NAME(cmd, cwd=root_dir)
    return output_dir