code: def attach_protocol(self, proto):
          
          if self._protocol is not None:
              raise RuntimeError("Already have a protocol.")
          # make sure we have nothing in self.unsaved
          self.save()
          self.__dict__['_protocol'] = proto
  
          # FIXME some of this is duplicated from ctor
          del self.__dict__['_accept_all_']
          self.__dict__['post_bootstrap'] = defer.Deferred()
          if proto.post_bootstrap:
              proto.post_bootstrap.addCallback(self.bootstrap)
          return self.__dict__['post_bootstrap']
docs: returns a Deferred that fires once we've set this object up to
          track the protocol. Fails if we already have a protocol.