code: def command(
      engine: str,
      format_: str,
      filepath=None,
      renderer: typing.Optional[str] = None,
      formatter: typing.Optional[str] = None,
  ):
      """Return args list for ``subprocess.Popen`` and name of the rendered file."""
      if formatter is not None and renderer is None:
          raise RequiredArgumentError(
              "formatter given without renderer"
          )
  
      if engine not in ENGINES:
          raise ValueError(f"unknown engine: {engine!r}")
      if format_ not in FORMATS:
          raise ValueError(f"unknown format: {format_!r}")
      if renderer is not None and renderer not in RENDERERS:
          raise ValueError(f"unknown renderer: {renderer!r}")
      if formatter is not None and formatter not in FORMATTERS:
          raise ValueError(f"unknown formatter: {formatter!r}")
  
      output_format = [
          f for f in (format_, renderer, formatter) if f is not None
      ]
      cmd = ["dot", "-K%s" % engine, "-T%s" % ":".join(output_format)]
  
      if filepath is None:
          rendered = None
      else:
          cmd.extend(["-O", filepath])
          suffix = ".".join(reversed(output_format))
          rendered = f"{filepath}.{suffix}"
  
      return cmd, rendered
  
imports: import errno
  import logging
  import os
  import platform
  import re
  import subprocess
  import sys
  import typing
  from .None import tools
label_desc: Use image node_id 1 for calling a global function with example usage: command(engine, format_, filepath, renderer, formatter) and returns: cmd,  rendered