code: def attach(self, upstream):
          
  
          if upstream == self.last_upstream():
              raise Exception("Can't attach a cache to itself")
  
          self._prior_upstreams.append(self.last_upstream())
  
          self.last_upstream().upstream = upstream
docs: Attach an upstream to the last upstream. Can be removed with detach