<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _handle_subscription(self, topics):
 """Handle subscription of topics."""

        if not isinstance(topics, list):
            topics = [topics]
        for topic in topics:
            topic_levels = topic.split('/')
            try:
                qos = int(topic_levels[-2])
            except ValueError:
                qos = 0
            try:
                _LOGGER.debug('Subscribing to: %s, qos: %s', topic, qos)
                self._sub_callback(topic, self.recv, qos)
            except Exception as exception:  # pylint: disable=broad-except
                _LOGGER.exception(
                    'Subscribe to %s failed: %s', topic, exception)