<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def write_paula(docgraph, output_root_dir, human_readable=False):
 """ converts a DiscourseDocumentGraph into a set of PAULA XML files representing the same document. Parameters docgraph : DiscourseDocumentGraph the document graph to be converted """

    paula_document = PaulaDocument(docgraph, human_readable=human_readable)
    error_msg = ("Please specify an output directory.\nPaula documents consist"
                 " of multiple files, so we can't just pipe them to STDOUT.")
    assert isinstance(output_root_dir, str), error_msg
    document_dir = os.path.join(output_root_dir, paula_document.name)
    if not os.path.isdir(document_dir):
        create_dir(document_dir)
    for paula_id in paula_document.files:
        with open(os.path.join(document_dir, paula_id+'.xml'), 'w') as outfile:
            outfile.write(
                paula_etree_to_string(paula_document.files[paula_id],
                                      paula_document.file2dtd[paula_id]))