<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def destroy(self):
 """ Destroy a fedmsg context """


        if getattr(self, 'publisher', None):
            self.log.debug("closing fedmsg publisher")
            self.log.debug("sent %i messages" % self._i)
            self.publisher.close()
            self.publisher = None

        if getattr(self, 'context', None):
            self.context.term()
            self.context = None