def quay(self, pubsub, node, _town, _stoparea, quay):
        items = pubsub.stanza.Items()
        items['node'] = node

        cursor = self.connection.cursor()
        rows = cursor.execute(KV1_QUAY_SQL, {'quay': quay})
        
        if rows > 0:
            q_dataownercode, q_publiccode, q_name, q_transportmode, q_longitude, q_latitude, q_altitude, q_x, q_y, q_description, q_boardinguse, q_aligtinguse, q_type = cursor.fetchone()
            item = pubsub.stanza.Item()
            quay_arguments = {'dataownercode': q_dataownercode, 'publiccode': q_publiccode, 'name': q_name, 'transportmode': q_transportmode, 'x': q_x, 'y': q_y, 'altitude': q_altitude, 'boardinguse': str(q_boardinguse).lower(), 'alightinguse': str(q_aligtinguse).lower(), 'quaytype': q_type, 'description': q_description}
            item['payload'] = ET.XML(netex_quay(quay_arguments))
            items.append(item)

        return items
    def nearestuserstop_get_items(self, pubsub, jid, node, x, y):
        cursor = self.connection.cursor()
        cursor.execute(KV1_NEAREST_USERSTOP_GET_ITEMS_SQL, {'x': x, 'y': y, 'maxitems': 10})
            
        items = pubsub.stanza.Items()
        items['node'] = node

        for dataownercode, areacode, areaname, areatown, areadescription, stopcode, stopname, stoptown, stopdescription, boardinguse, alightinguse, locationx, locationy, locationz in cursor.fetchall():
            if stopdescription is None:
                stopdescription = ''

            quay_arguments = {'dataownercode': dataownercode, 'publiccode': stopcode, 'name': stopname, 'transportmode': modality_quay[self.name], 'x': locationx, 'y': locationy, 'altitude': locationz, 'boardinguse': str(boardinguse).lower(), 'alightinguse': str(alightinguse).lower(), 'quaytype': modality_quaytype[self.name], 'description': stopdescription}

            item = pubsub.stanza.Item()
            item['id'] = '%(userstopcode)s' % {'dataownercode': dataownercode, 'userstopcode': stopcode}
            item['payload'] = ET.XML(netex_quay(quay_arguments))

            items.append(item)

        return items
    def stopplace(self, pubsub, node, town, stoparea):
        items = pubsub.stanza.Items()
        items['node'] = node

        cursor = self.connection.cursor()
        rows = cursor.execute(KV1_STOPPLACE_QUAYS_SQL, {'stoparea': stoparea})

        if rows > 0:
            quays = ''
            item = pubsub.stanza.Item()

            for sp_id, sp_name, sp_description, sp_type, sp_street, sp_town, sp_postalregion, q_dataownercode, q_publiccode, q_name, q_transportmode, q_longitude, q_latitude, q_altitude, q_x, q_y, q_description, q_boardinguse, q_aligtinguse, q_type in cursor.fetchall():
                quay_arguments = {'dataownercode': q_dataownercode, 'publiccode': q_publiccode, 'name': q_name, 'transportmode': q_transportmode, 'x': q_x, 'y': q_y, 'altitude': q_altitude, 'boardinguse': str(q_boardinguse).lower(), 'alightinguse': str(q_aligtinguse).lower(), 'quaytype': q_type, 'description': q_description}
                quays += netex_quay(quay_arguments)

            # TODO, a lot of things, like clean up but also escape for XML
            stopplace_arguments = { 'stopplaceid': sp_id, 'name': sp_name, 'town': sp_town, 'description': sp_description, 'stopplacetype': sp_type, 'street': sp_street, 'postalregion': sp_postalregion, 'quays': quays }
            item['payload'] = ET.XML(netex_stopplace(stopplace_arguments))
            items.append(item)

        return items