<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def printText (self, stream=None):
 """Prints a text representation of this sequence to the given stream or standard output. """

    if stream is None:
      stream = sys.stdout

    stream.write('# seqid   : %u\n'     % self.seqid         )
    stream.write('# version : %u\n'     % self.version       )
    stream.write('# crc32   : 0x%04x\n' % self.crc32         )
    stream.write('# ncmds   : %u\n'     % len(self.commands) )
    stream.write('# duration: %.3fs\n'  % self.duration      )
    stream.write('\n')

    for line in self.lines:
      stream.write( str(line) )
      stream.write('\n')