def METHOD_NAME(
    self,
    graph,  # type: DiGraph
    render_fp,  # type: IO
):
    # type: (...) -> Result
    read_fd, write_fd = os.pipe()
    def emit():
        with os.fdopen(write_fd, "w") as fp:
            graph.emit(fp)
    emit_thread = threading.Thread(name="{} Emitter".format(__name__), target=emit)
    emit_thread.daemon = True
    emit_thread.start()
    try:
        return try_run_program(
            "dot",
            url="https://graphviz.org/",
            error="Failed to render dependency graph for {}.".format(graph.name),
            args=["-T", self.options.format],
            stdin=read_fd,
            stdout=render_fp,
        )
    finally:
        emit_thread.join()