def _spec_from_via(self, proxied_inventory_name, via_spec):
        """
        Produce a dict connection specifiction given a string `via_spec`, of
        the form `[[become_method:]become_user@]inventory_hostname`.
        """
        become_user, _, inventory_name = via_spec.rpartition('@')
        become_method, _, become_user = become_user.rpartition(':')

        # must use __contains__ to avoid a TypeError for a missing host on
        # Ansible 2.3.
        if self.host_vars is None or inventory_name not in self.host_vars:
            raise ansible.errors.AnsibleConnectionFailure(
                self.unknown_via_msg % (
                    via_spec,
                    proxied_inventory_name,
                )
            )

        via_vars = self.host_vars[inventory_name]
        return ansible_mitogen.transport_config.MitogenViaSpec(
            inventory_name=inventory_name,
            play_context=self._play_context,
            host_vars=dict(via_vars),  # TODO: make it lazy
            become_method=become_method or None,
            become_user=become_user or None,
        )
Produce a dict connection specifiction given a string `via_spec`, of
        the form `[[become_method:]become_user@]inventory_hostname`.