code: def run(
      args: List[Any],
      capture_stdout: bool = True,
      capture_stderr: bool = True,
      input: Optional[bytes] = None,
      return_stderr: bool = False,
      env: Optional[Dict[str, str]] = None,
  ) -> Union[str, Tuple[str, str]]:
      args = [str(x) for x in args]
      subprocess_env = dict(os.environ)
      subprocess_env.update(env or {})
      if args[1] == "buildx":
          subprocess_env["DOCKER_CLI_EXPERIMENTAL"] = "enabled"
      stdout_dest: Optional[int] = (
          subprocess.PIPE if capture_stdout else None
      )
      stderr_dest: Optional[int] = (
          subprocess.PIPE if capture_stderr else None
      )
  
      completed_process = subprocess.run(
          args,
          input=input,
          stdout=stdout_dest,
          stderr=stderr_dest,
          env=subprocess_env,
      )
      if completed_process.returncode != 0:
          raise DockerError(
              args,
              completed_process.returncode,
              completed_process.stdout,
              completed_process.stderr,
          )
  
      if return_stderr:
          return (
              _post_process_stream(completed_process.stdout),
              _post_process_stream(completed_process.stderr),
          )
      else:
          return _post_process_stream(completed_process.stdout)
  
imports: import json
  import logging
  import os
  import subprocess
  from typing import Any, Dict, List, Optional, Tuple, Union
  import requests
  from dockerpycreds.utils import find_executable
  from wandb.docker import auth, www_authenticate
  from wandb.errors import Error
label_desc: Use image node_id 7 for calling a global function with example usage: run(args, capture_stdout, capture_stderr, input, return_stderr, env) and returns: _post_process_stream,  _post_process_stream, _post_process_stream