def check_port(port, host, timeout=<NUM_LIT:10>):
logger.info("<STR_LIT>", host, port)<EOL>sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)<EOL>try:<EOL><INDENT>sock.settimeout(timeout)<EOL>result = sock.connect_ex((host, port))<EOL>logger.info("<STR_LIT>", result)<EOL>if result == <NUM_LIT:0>:<EOL><INDENT>logger.debug('<STR_LIT>' % (host, port))<EOL>return True<EOL><DEDENT>else:<EOL><INDENT>logger.debug('<STR_LIT>' % (host, port))<EOL>return False<EOL><DEDENT><DEDENT>finally:<EOL><INDENT>sock.close()<EOL><DEDENT>
connect to port on host and return True on success

:param port: int, port to check
:param host: string, host address
:param timeout: int, number of seconds spent trying
:return: bool