human
Complete the below
def main():

    ''''Run a simple echo pb server to test the checker. It defines a custom query
    for dealing with sqlite special quoting, but otherwise it\'s a
    straightforward use of the object.
    You can test it running C{pbechoclient.py}.'
    '''
assistant
#Here is the Python code you requested.
    import sys
    from twisted.python import log
    log.startLogging(sys.stdout)
    import os
    if os.path.isfile('testcred'):
        os.remove('testcred')
    from twisted.enterprise import adbapi
    pool = adbapi.ConnectionPool('pysqlite2.dbapi2', 'testcred')
    query1 = 'CREATE    TABLE    user    (\n                                                username    string,\n                                                password    string\n                                )'
    query2 = "INSERT    INTO    user    VALUES    ('guest',    'guest')"
    def cb(res):
        pool.runQuery(query2)
    pool.runQuery(query1).addCallback(cb)
    checker = DBCredentialsChecker(pool.runQuery, query='SELECT    username,    password    FROM    user    WHERE    username    =    ?')
    from twisted.cred.portal import Portal
    import pbecho
    from twisted.spread import pb
    portal = Portal(pbecho.SimpleRealm())
    portal.registerChecker(checker)
    reactor.listenTCP(pb.portno, pb.PBServerFactory(portal))