code: def render_to_cairo_document(output_filename, papersize_tuple, layout):
      
      doc = cairo.PDFSurface(output_filename, *papersize_tuple)
      c = cairo.Context(doc)
      render_to_cairo_context(c, papersize_tuple, layout)
docs: Create and save a document with contents of the given layout manager.