'Return processed and validated session list.
Output: array'

def get_current_activity(self):

    session_data = self.get_sessions(output_format='xml')
    try:
        xml_head = session_data.getElementsByTagName('MediaContainer')
    except Exception as e:
        logger.warn((u'PlexPy    Pmsconnect    ::    Unable    to    parse    XML    for    get_current_activity:    %s.' % e))
        return []
    session_list = []
    for a in xml_head:
        if a.getAttribute('size'):
            if (a.getAttribute('size') == '0'):
                session_list = {'stream_count': '0', 'sessions': []}
                return session_list
        if a.getElementsByTagName('Track'):
            session_data = a.getElementsByTagName('Track')
            session_type = 'track'
            for session_ in session_data:
                session_output = self.get_session_each(session_type, session_)
                session_list.append(session_output)
        if a.getElementsByTagName('Video'):
            session_data = a.getElementsByTagName('Video')
            session_type = 'video'
            for session_ in session_data:
                session_output = self.get_session_each(session_type, session_)
                session_list.append(session_output)
        if a.getElementsByTagName('Photo'):
            session_data = a.getElementsByTagName('Photo')
            session_type = 'photo'
            for session_ in session_data:
                session_output = self.get_session_each(session_type, session_)
                session_list.append(session_output)
    session_list = sorted(session_list, key=(lambda k: k['session_key']))
    output = {'stream_count': helpers.get_xml_attr(xml_head[0], 'size'), 'sessions': session.mask_session_info(session_list)}
    return output
