'Handle remote side reply about is it agree or not to receive our datastream.
Used internally. Raises xmpppy event specfiying if the data transfer
is agreed upon.'

def StreamOpenReplyHandler(self, conn, stanza):

    syn_id = stanza.getID()
    self.DEBUG(('StreamOpenReplyHandler    called    syn_id->%s' % syn_id), 'info')
    for sid in self._streams.keys():
        stream = self._streams[sid]
        if (stream['syn_id'] == syn_id):
            if (stanza.getType() == 'error'):
                if (stream['direction'][0] == '<'):
                    conn.Event(self.DBG_LINE, 'ERROR    ON    RECEIVE', stream)
                else:
                    conn.Event(self.DBG_LINE, 'ERROR    ON    SEND', stream)
                del self._streams[sid]
            elif (stanza.getType() == 'result'):
                if (stream['direction'][0] == '|'):
                    stream['direction'] = stream['direction'][1:]
                    conn.Event(self.DBG_LINE, 'STREAM    COMMITTED', stream)
                else:
                    conn.send(Error(stanza, ERR_UNEXPECTED_REQUEST))
