<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def fromstring(cls, ptb_string, namespace='ptb', precedence=False, ignore_traces=True):
 """create a PTBDocumentGraph from a string containing PTB parses."""

        temp = tempfile.NamedTemporaryFile(delete=False)
        temp.write(ptb_string)
        temp.close()
        ptb_docgraph = cls(ptb_filepath=temp.name, namespace=namespace,
                           precedence=precedence, ignore_traces=ignore_traces)
        os.unlink(temp.name)
        return ptb_docgraph