def lookup(self, nick):
		query = """
			SELECT fromnick, message, notifytime, notifyid
			FROM notify WHERE tonick = ?
		"""
		''' Ugly, but will work with sqlite3 or pysqlite2 '''
		messages = [
			{
				'fromnick': x[0],
				'message': x[1],
				'notifytime': x[2],
				'notifyid': x[3],
			}
			for x in self.db.execute(query, [nick])
		]
		ids = [x['notifyid'] for x in messages]
		query = """
			DELETE FROM notify
			WHERE notifyid IN (%s)
			""" % ','.join('?' for x in ids)
		self.db.execute(query, ids)

		return messages