def _chooseConnection(ctype, name, results):
<EOL>for url, token, result, runtime in results:<EOL><INDENT>okerr = '<STR_LIT:OK>' if result else '<STR_LIT>'<EOL>log.info('<STR_LIT>', ctype, okerr, runtime, url, token)<EOL><DEDENT>results = [r[<NUM_LIT:2>] for r in results if r and r[<NUM_LIT:2>] is not None]<EOL>if results:<EOL><INDENT>log.info('<STR_LIT>', ctype, results[<NUM_LIT:0>]._baseurl, results[<NUM_LIT:0>]._token)<EOL>return results[<NUM_LIT:0>]<EOL><DEDENT>raise NotFound('<STR_LIT>' % (ctype.lower(), name))<EOL>
Chooses the first (best) connection from the given _connect results.