def __init__(
        self,
        hosts,
        user=None,
        password=None,
        pkey_file=None,
        pkey_material=None,
        port=22,
        bastion_host=None,
        concurrency=10,
        raise_on_any_error=False,
        connect=True,
        passphrase=None,
        handle_stdout_line_func=None,
        handle_stderr_line_func=None,
        sudo_password=False,
    ):
        """
        :param handle_stdout_line_func: Callback function which is called dynamically each time a
                                        new stdout line is received.
        :type handle_stdout_line_func: ``func``

        :param handle_stderr_line_func: Callback function which is called dynamically each time a
                                        new stderr line is received.
        :type handle_stderr_line_func: ``func``
        """
        self._ssh_user = user
        self._ssh_key_file = pkey_file
        self._ssh_key_material = pkey_material
        self._ssh_password = password
        self._hosts = hosts
        self._successful_connects = 0
        self._ssh_port = port
        self._bastion_host = bastion_host
        self._passphrase = passphrase
        self._handle_stdout_line_func = handle_stdout_line_func
        self._handle_stderr_line_func = handle_stderr_line_func
        self._sudo_password = sudo_password

        if not hosts:
            raise Exception("Need an non-empty list of hosts to talk to.")

        self._pool = concurrency_lib.get_green_pool_class()(concurrency)
        self._hosts_client = {}
        self._bad_hosts = {}
        self._scan_interval = 0.1

        if connect:
            connect_results = self.connect(raise_on_any_error=raise_on_any_error)
            extra = {"_connect_results": connect_results}
            LOG.debug("Connect to hosts complete.", extra=extra)

        :param handle_stdout_line_func: Callback function which is called dynamically each time a
                                        new stdout line is received.
        :type handle_stdout_line_func: ``func``

        :param handle_stderr_line_func: Callback function which is called dynamically each time a
                                        new stderr line is received.
        :type handle_stderr_line_func: ``func``
        
st2common/st2common/runners/parallel_ssh.py