'Called by server for having the portal relay messages and data
to the correct session protocol.
Args:
session (Session): Session sending data.
Kwargs:
kwargs (any): Each key is a command instruction to the
protocol on the form key = [[args],{kwargs}]. This will
call a method send_<key> on the protocol. If no such
method exixts, it sends the data to a method send_default.'

def data_out(self, session, **kwargs):

    if session:
        for (cmdname, (cmdargs, cmdkwargs)) in kwargs.iteritems():
            funcname = ('send_%s' % cmdname.strip().lower())
            if hasattr(session, funcname):
                try:
                    getattr(session, funcname)(*cmdargs, **cmdkwargs)
                except Exception:
                    log_trace()
            else:
                try:
                    session.send_default(cmdname, *cmdargs, **cmdkwargs)
                except Exception:
                    log_trace()
