def has_session(self, target_session):
        """Return True if session exists. ``$ tmux has-session``.

        :param: target_session: str of session name.
        :rtype: bool

        """

        proc = self.cmd('has-session', '-t%s' % target_session)

        if proc.stdout == []:
            return True
        if any(
            x in proc.stdout for x in
            ['failed to connect to server', 'error connecting to']
        ):
            return False
        elif proc.stdout in 'no server running':  # tmux 2.0
            return False
        elif 'can\'t find session' in proc.stdout:  # tmux 2.1
            return False
        elif 'session not found' in proc.stdout:
            return False
        else:
            return True
dataset/ETHPy150Open tony/tmuxp/tmuxp/server.py/Server.has_session/swapped operands of `in`