'processes an incoming packet.
:param packet: The incoming packet dictionary.'

def _process_packet(self, session, packet):

    session.last_contact_time = time()
    if (packet['opcode'] == OPCODE_ERROR):
        self._logger.warning(u'%s    got    ERROR    message:    code    =    %s,    msg    =    %s', session, packet['error_code'], packet['error_msg'])
        session.is_failed = True
        return
    if session.is_client:
        self._handle_packet_as_receiver(session, packet)
    else:
        self._handle_packet_as_sender(session, packet)
