def attached_sessions(self):
        """Return active :class:`Session` objects.

        This will not work where multiple tmux sessions are attached.

        :rtype: :py:obj:`list` of :class:`Session`

        """

        sessions = self._sessions
        attached_sessions = list()

        for session in sessions:
            if 'session_attached' in session:
                # for now session_active is a unicode
                if session.get('session_attached') == '1':
                    logger.debug('session %s attached', session.get(
                        'session_name'))
                    attached_sessions.append(session)
                else:
                    continue

        return [
                   Session(server=self, **s) for s in attached_sessions
               ] or None
dataset/ETHPy150Open tony/tmuxp/tmuxp/server.py/Server.attached_sessions/original