def wait_socket(_socket, session, timeout=<NUM_LIT:1>):
directions = session.block_directions()<EOL>if directions == <NUM_LIT:0>:<EOL><INDENT>return <NUM_LIT:0><EOL><DEDENT>readfds = [_socket]if (directions & LIBSSH2_SESSION_BLOCK_INBOUND) else ()<EOL>writefds = [_socket]if (directions & LIBSSH2_SESSION_BLOCK_OUTBOUND) else ()<EOL>return select(readfds, writefds, (), timeout)<EOL>
Helper function for testing non-blocking mode.

    This function blocks the calling thread for <timeout> seconds -
    to be used only for testing purposes.

    Also available at `ssh2.utils.wait_socket`