def cmd_iter(
            self,
            tgt,
            fun,
            arg=(),
            timeout=None,
            tgt_type='glob',
            ret='',
            kwarg=None,
            **kwargs):
        '''
        Yields the individual minion returns as they come in

        The function signature is the same as :py:meth:`cmd` with the
        following exceptions.

        Normally :py:meth:`cmd_iter` does not yield results for minions that
        are not connected. If you want it to return results for disconnected
        minions set `expect_minions=True` in `kwargs`.

        :return: A generator yielding the individual minion returns

        .. code-block:: python

            >>> ret = local.cmd_iter('*', 'test.ping')
            >>> for i in ret:
            ...     print(i)
            {'jerry': {'ret': True}}
            {'dave': {'ret': True}}
            {'stewart': {'ret': True}}
        '''
        was_listening = self.event.cpub

        try:
            pub_data = self.run_job(
                tgt,
                fun,
                arg,
                tgt_type,
                ret,
                timeout,
                kwarg=kwarg,
                listen=True,
                **kwargs)

            if not pub_data:
                yield pub_data
            else:
                if kwargs.get('yield_pub_data'):
                    yield pub_data
                for fn_ret in self.get_iter_returns(pub_data['jid'],
                                                    pub_data['minions'],
                                                    timeout=self._get_timeout(timeout),
                                                    tgt=tgt,
                                                    tgt_type=tgt_type,
                                                    **kwargs):
                    if not fn_ret:
                        continue
                    yield fn_ret
                self._clean_up_subscriptions(pub_data['jid'])
        finally:
            if not was_listening:
                self.event.close_pub()
Yields the individual minion returns as they come in

        The function signature is the same as :py:meth:`cmd` with the
        following exceptions.

        Normally :py:meth:`cmd_iter` does not yield results for minions that
        are not connected. If you want it to return results for disconnected
        minions set `expect_minions=True` in `kwargs`.

        :return: A generator yielding the individual minion returns

        .. code-block:: python

            >>> ret = local.cmd_iter('*', 'test.ping')
            >>> for i in ret:
            ...     print(i)
            {'jerry': {'ret': True}}
            {'dave': {'ret': True}}
            {'stewart': {'ret': True}}