'Receives and handles admin operations sent to the Portal
This is executed on the Portal.
Args:
packed_data (str): Data received, a pickled tuple (sessid, kwargs).'

@AdminServer2Portal.responder
def portal_receive_adminserver2portal(self, packed_data):

    (sessid, kwargs) = loads(packed_data)
    operation = kwargs.pop('operation')
    portal_sessionhandler = self.factory.portal.sessions
    if (operation == SLOGIN):
        session = portal_sessionhandler.get(sessid)
        if session:
            portal_sessionhandler.server_logged_in(session, kwargs.get('sessiondata'))
    elif (operation == SDISCONN):
        session = portal_sessionhandler.get(sessid)
        if session:
            portal_sessionhandler.server_disconnect(session, reason=kwargs.get('reason'))
    elif (operation == SDISCONNALL):
        portal_sessionhandler.server_disconnect_all(reason=kwargs.get('reason'))
    elif (operation == SSHUTD):
        self.factory.portal.shutdown(restart=False)
    elif (operation == SSYNC):
        portal_sessionhandler.server_session_sync(kwargs.get('sessiondata'), kwargs.get('clean', True))
        self.factory.server_restart_mode = True
    elif (operation == SCONN):
        portal_sessionhandler.server_connect(**kwargs)
    else:
        raise Exception(('operation    %(op)s    not    recognized.' % {'op': operation}))
    return {}
