code: def open_session(self, protocol_factory, peer_jid, *,
                       stanza_type=ibb_xso.IBBStanzaType.IQ,
                       block_size=4096, sid=None):
          
          if block_size > MAX_BLOCK_SIZE:
              raise ValueError("block_size too large")
  
          if sid is None:
              sid = utils.to_nmtoken(random.getrandbits(8*8))
          open_ = ibb_xso.Open()
          open_.stanza = stanza_type
          open_.sid = sid
          open_.block_size = block_size
  
          # XXX: retry on XMPPModifyError with RESOURCE_CONSTRAINT
          yield from self.client.send(
              aioxmpp.IQ(
                  aioxmpp.IQType.SET,
                  to=peer_jid,
                  payload=open_,
              )
          )
  
          handle = self._sessions[sid, peer_jid] = IBBTransport(
              self,
              peer_jid,
              sid,
              stanza_type,
              block_size,
          )
  
          protocol = protocol_factory()
          handle.set_protocol(protocol)
          return handle, protocol
docs: Establish an in-band bytestream session with `peer_jid` and
          return the transport and protocol.
  
          :param protocol_factory: the protocol factory
          :type protocol_factory: a nullary callable returning an
                                  :class:`asyncio.Protocol` instance
          :param peer_jid: the JID with which to establish the byte-stream.
          :type peer_jid: :class:`aioxmpp.JID`
          :param stanza_type: the stanza type to use
          :type stanza_type: class:`~aioxmpp.ibb.IBBStanzaType`
          :param block_size: the maximal size of blocks to transfer
          :type block_size: :class:`int`
          :param sid: the session id to use
          :type sid: :class:`str` (must be a valid NMTOKEN)
  
          :returns: the transport and protocol
          :rtype: a tuple of :class:`aioxmpp.ibb.service.IBBTransport`
                  and :class:`asyncio.Protocol`