'Start new stream. You should provide stream id \'sid\', the endpoind jid \'to\',
the file object containing info for send \'fp\'. Also the desired blocksize can be specified.
Take into account that recommended stanza size is 4k and IBB uses base64 encoding
that increases size of data by 1/3.'

def OpenStream(self, sid, to, fp, blocksize=3000):

    if (sid in self._streams.keys()):
        return
    if (not JID(to).getResource()):
        return
    self._streams[sid] = {'direction': ('|>' + to), 'block-size': blocksize, 'fp': fp, 'seq': 0}
    self._owner.RegisterCycleHandler(self.SendHandler)
    syn = Protocol('iq', to, 'set', payload=[Node((NS_IBB + '    open'), {'sid': sid, 'block-size': blocksize})])
    self._owner.send(syn)
    self._streams[sid]['syn_id'] = syn.getID()
    return self._streams[sid]
