def METHOD_NAME(self):
    lines = []
    if self.id:
        lines.append('id: %s' % self.id)
    # Only include an event line if it's not the default already.
    if self.event != 'message':
        lines.append('event: %s' % self.event)
    if self.retry:
        lines.append('retry: %s' % self.retry)
    lines.extend('data: %s' % d for d in self.data.split('\n'))
    return '\n'.join(lines) + '\n\n'