'Send the GNTP Packet'

def _send(self, messagetype, packet):

    packet.validate()
    data = packet.encode()
    logger.debug('To    :    %s:%s    <%s>\n%s', self.hostname, self.port, packet.__class__, data)
    s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    s.settimeout(self.socketTimeout)
    try:
        s.connect((self.hostname, self.port))
        s.send(data)
        recv_data = s.recv(1024)
        while (not recv_data.endswith(gntp.shim.b('\r\n\r\n'))):
            recv_data += s.recv(1024)
    except socket.error:
        exc = sys.exc_info()[1]
        raise errors.NetworkError(exc)
    response = gntp.core.parse_gntp(recv_data)
    s.close()
    logger.debug('From    :    %s:%s    <%s>\n%s', self.hostname, self.port, response.__class__, response)
    if (type(response) == gntp.core.GNTPOK):
        return True
    logger.error('Invalid    response:    %s', response.error())
    return response.error()
