code: def unsubscribe(self, topic):
          # type: (str) -> Optional[Tuple[int, int]]
          
          # don't unsubscribe if not in topics
          if topic in self.topics:
              result, mid = self.client.unsubscribe(topic)
  
              if result == MQTT_ERR_SUCCESS:
                  self.topics.pop(topic)
                  logger.debug('Unsubscribed from topic: {0}'.format(topic))
              else:
                  logger.debug('Error {0} unsubscribing from topic: {1}'
                               .format(result, topic))
  
              # if successful remove from topics
              return result, mid
          return None
docs: Unsubscribe from a single topic.
  
          :param topic: a single string that is the subscription topic to
                        unsubscribe from
  
          :rtype: (int, int)
          :result: (result, mid)
  
          Returns a tuple (result, mid), where result is MQTT_ERR_SUCCESS
          to indicate success or (MQTT_ERR_NO_CONN, None) if the client is not
          currently connected.
          mid is the message ID for the unsubscribe request. The mid value can be
          used to track the unsubscribe request by checking against the mid
          argument in the on_unsubscribe() callback if it is defined.