Execute a command on a given server using asynchronous SSH-connection.

    The connection to the server is wrapped in :func:`asyncio.wait_for` and
    given :attr:`timeout` is applied to it. If the server is not reachable
    before timeout expires, :exc:`asyncio.TimeoutError` is raised.

    :param str server: Address of the server
    :param str cmd: Command to be executed
    :param int timeout: Timeout to connect to server.

    :param ssh_kwargs:
        Any additional SSH-connection arguments, as specified by
        :func:`asyncssh.connect`. See `asyncssh documentation
        <http://asyncssh.readthedocs.io/en/latest/api.html#connect>`_ for
        details.

    :returns:
        closed SSH-connection

async def ssh_exec(server, cmd, timeout=10, **ssh_kwargs):
    """Execute a command on a given server using asynchronous SSH-connection.

    The connection to the server is wrapped in :func:`asyncio.wait_for` and
    given :attr:`timeout` is applied to it. If the server is not reachable
    before timeout expires, :exc:`asyncio.TimeoutError` is raised.

    :param str server: Address of the server
    :param str cmd: Command to be executed
    :param int timeout: Timeout to connect to server.

    :param ssh_kwargs:
        Any additional SSH-connection arguments, as specified by
        :func:`asyncssh.connect`. See `asyncssh documentation
        <http://asyncssh.readthedocs.io/en/latest/api.html#connect>`_ for
        details.

    :returns:
        closed SSH-connection
    """
    conn = await asyncio.wait_for(asyncssh.connect(server, **ssh_kwargs),
                                  timeout=timeout)
    ret = await conn.run(cmd)
    conn.close()
    return ret