<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def do_cons(self, params):
 """ \x1b[1mNAME\x1b[0m cons - Executes the cons four-letter command \x1b[1mSYNOPSIS\x1b[0m cons [hosts] [match] \x1b[1mOPTIONS\x1b[0m * hosts: the hosts to connect to (default: the current connected host) * match: only output lines that include the given string (default: '') \x1b[1mEXAMPLES\x1b[0m > cons /127.0.0.1:40535[0](queued=0,recved=1,sent=0) """

        hosts = params.hosts if params.hosts != "" else None

        if hosts is not None and invalid_hosts(hosts):
            self.show_output("List of hosts has the wrong syntax.")
            return

        if self._zk is None:
            self._zk = XClient()

        try:
            content = get_matching(self._zk.cons(hosts), params.match)
            self.show_output(content)
        except XClient.CmdFailed as ex:
            self.show_output(str(ex))