def print_dot(path: str, filename: str, g: 'DotGraph') -> str:
    if (not os.path.isabs(filename)):
        filename = os.path.join(path, filename)
    dotfilename = (filename + '.dot')
    pdffilename = (filename + '.pdf')
    with open(dotfilename, 'w') as fp:
        fp.write(str(g))
    cmd = ['dot', '-Tpdf', '-o', pdffilename, dotfilename]
    try:
        subprocess.call(cmd, stderr=subprocess.STDOUT)
    except subprocess.CalledProcessError as e:
        print(('Error in processing dot file: ' + dotfilename))
        print(e.output)
        print(e.args)
        exit(1)
    return pdffilename
def print_dot(path: str, filename: str, g: 'DotGraph') -> str:
    if (not os.path.isabs(filename)):
        filename = os.path.join(path, filename)
    dotfilename = (filename + '.dot')
    pdffilename = (filename + '.pdf')
    with open(dotfilename, 'w') as fp:
        fp.write(str(g))
    cmd = ['dot', '-Tpdf', '-o', pdffilename, dotfilename]
    try:
        subprocess.call(cmd, stderr=subprocess.STDOUT)
    except subprocess.CalledProcessError as e:
        print(('Error in processing dot file: ' + dotfilename))
        print(e.output)
        print(e.args)
        exit(1)
    return pdffilename