code: def render_latex(latex: str) -> PIL.Image:      # pragma: no cover
      
      tmpfilename = 'circ'
      with tempfile.TemporaryDirectory() as tmpdirname:
          tmppath = os.path.join(tmpdirname, tmpfilename)
          with open(tmppath + '.tex', 'w') as latex_file:
              latex_file.write(latex)
  
          subprocess.run(["pdflatex",
                          "-halt-on-error",
                          "-output-directory={}".format(tmpdirname),
                          "{}".format(tmpfilename+'.tex')],
                         stdout=subprocess.PIPE,
                         stderr=subprocess.DEVNULL,
                         check=True)
  
          subprocess.run(['pdftocairo',
                          '-singlefile',
                          '-png',
                          '-q',
                          tmppath + '.pdf',
                          tmppath])
          img = PIL.Image.open(tmppath + '.png')
  
      return img
docs: Convert a single page LaTeX document into an image.
  
      To display the returned image, `img.show()`
  
  
      Required external dependencies: `pdflatex` (with `qcircuit` package),
      and `poppler` (for `pdftocairo`).
  
      Args:
          A LaTeX document as a string.
  
      Returns:
          A PIL Image
  
      Raises:
          OSError: If an external dependency is not installed.