'Transform a chunk of a message to POP3 message format.
Make sure each line ends with C{\'\r\n\'} and byte-stuff the
termination character (C{\'.\'}) by adding an extra one when one appears
at the beginning of a line.
@type chunk: L{bytes}
@param chunk: A string to transform.
@rtype: L{bytes}
@return: The transformed string.'

def transformChunk(self, chunk):

    return chunk.replace('\n', '\r\n').replace('\r\n.', '\r\n..')
