'Send next portion of data if it is time to do it. Used internally.'

def SendHandler(self, conn):

    self.DEBUG('SendHandler    called', 'info')
    for sid in self._streams.keys():
        stream = self._streams[sid]
        if (stream['direction'][:2] == '|>'):
            cont = 1
        elif (stream['direction'][0] == '>'):
            chunk = stream['fp'].read(stream['block-size'])
            if chunk:
                datanode = Node((NS_IBB + '    data'), {'sid': sid, 'seq': stream['seq']}, base64.encodestring(chunk))
                stream['seq'] += 1
                if (stream['seq'] == 65536):
                    stream['seq'] = 0
                conn.send(Protocol('message', stream['direction'][1:], payload=[datanode, self._ampnode]))
            else:
                '    notify    the    other    side    about    stream    closing\n                                                                                                notify    the    local    user    about    sucessfull    send\n                                                                                                delete    the    local    stream'
                conn.send(Protocol('iq', stream['direction'][1:], 'set', payload=[Node((NS_IBB + '    close'), {'sid': sid})]))
                conn.Event(self.DBG_LINE, 'SUCCESSFULL    SEND', stream)
                del self._streams[sid]
                self._owner.UnregisterCycleHandler(self.SendHandler)
                "\n<message    from='romeo@montague.net/orchard'    to='juliet@capulet.com/balcony'    id='msg1'>\n        <data    xmlns='http://jabber.org/protocol/ibb'    sid='mySID'    seq='0'>\n                qANQR1DBwU4DX7jmYZnncmUQB/9KuKBddzQH+tZ1ZywKK0yHKnq57kWq+RFtQdCJ\n                WpdWpR0uQsuJe7+vh3NWn59/gTc5MDlX8dS9p0ovStmNcyLhxVgmqS8ZKhsblVeu\n                IpQ0JgavABqibJolc3BKrVtVV1igKiX/N7Pi8RtY1K18toaMDhdEfhBRzO/XB0+P\n                AQhYlRjNacGcslkhXqNjK5Va4tuOAPy2n1Q8UUrHbUd0g+xJ9Bm0G0LZXyvCWyKH\n                kuNEHFQiLuCY6Iv0myq6iX6tjuHehZlFSh80b5BVV9tNLwNR5Eqz1klxMhoghJOA\n        </data>\n        <amp    xmlns='http://jabber.org/protocol/amp'>\n                <rule    condition='deliver-at'    value='stored'    action='error'/>\n                <rule    condition='match-resource'    value='exact'    action='error'/>\n        </amp>\n</message>\n"
