code: def render(
      engine: str,
      format: str,
      filepath,
      renderer: typing.Optional[str] = None,
      formatter: typing.Optional[str] = None,
      quiet: bool = False,
  ) -> str:
      """Render file with Graphviz ``engine`` into ``format``,  return result filename.
  
      Args:
          engine: Layout commmand for rendering (``'dot'``, ``'neato'``, ...).
          format: Output format for rendering (``'pdf'``, ``'png'``, ...).
          filepath: Path to the DOT source file to render.
          renderer: Output renderer (``'cairo'``, ``'gd'``, ...).
          formatter: Output formatter (``'cairo'``, ``'gd'``, ...).
          quiet: Suppress ``stderr`` output from the layout subprocess.
  
      Returns:
          The (possibly relative) path of the rendered file.
  
      Raises:
          ValueError: If ``engine``, ``format``, ``renderer``, or ``formatter`` are not known.
          graphviz.RequiredArgumentError: If ``formatter`` is given but ``renderer`` is None.
          graphviz.ExecutableNotFound: If the Graphviz executable is not found.
          subprocess.CalledProcessError: If the exit status is non-zero.
  
      Note:
          The layout command is started from the directory of ``filepath``, so that
          references to external files (e.g. ``[image=...]``) can be given as paths
          relative to the DOT source file.
      """
      dirname, filename = os.path.split(filepath)
      del filepath
  
      cmd, rendered = command(
          engine, format, filename, renderer, formatter
      )
      if dirname:
          cwd = dirname
          rendered = os.path.join(dirname, rendered)
      else:
          cwd = None
  
      run(cmd, capture_output=True, cwd=cwd, check=True, quiet=quiet)
      return 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 3 for calling a global function with example usage: render(engine, format, filepath, renderer, formatter, quiet) and returns: rendered