code: def connect(self, recver):
          
          r1 = recver
          m1 = r1.middle
          s2 = self
          m2 = self.middle
          r2 = self.other
  
          r2.middle = m1
          del m2.sender
          del m2.recver
  
          del m1.recver
          m1.recver = weakref.ref(r2, m1.on_abandoned)
          m1.recver_current = m2.recver_current
  
          del r1.middle
          del s2.middle
  
          # if we are currently a chain, return the last recver of our chain
          while True:
              if getattr(r2, 'downstream', None) is None:
                  break
              r2 = r2.downstream.other
          return r2
docs: Rewire:
              s1 -> m1 <- r1 --> s2 -> m2 <- r2
          To:
              s1 -> m1 <- r2