<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(klass, document, target=None, stylesheet=""):
 """ convert a pyth document to a latex document we can specify a stylesheet as a latex document fragment that will be inserted after the headers. This way we can override the default style. """

        writer = LatexWriter(document, target, stylesheet)
        return writer.go()