'Encode a GNTP Registration Message
:return string: Encoded GNTP Registration message. Returned as a byte string'

def encode(self):

    buff = _GNTPBuffer()
    buff.writeln(self._format_info())
    for (k, v) in self.headers.items():
        buff.writeheader(k, v)
    buff.writeln()
    if (len(self.notifications) > 0):
        for notice in self.notifications:
            for (k, v) in notice.items():
                buff.writeheader(k, v)
            buff.writeln()
    for (resource, data) in self.resources.items():
        buff.writeheader('Identifier', resource)
        buff.writeheader('Length', len(data))
        buff.writeln()
        buff.write(data)
        buff.writeln()
        buff.writeln()
    return buff.getvalue()
