code: def tags_impl(self):
      
      if self._db_connection_provider:
        # Read tags from the database.
        db = self._db_connection_provider()
        cursor = db.execute('''
          SELECT
            Tags.tag_name,
            Tags.display_name,
            Runs.run_name
          FROM Tags
          JOIN Runs
            ON Tags.run_id = Runs.run_id
          WHERE
            Tags.plugin_name = ?
        ''', (metadata.PLUGIN_NAME,))
        result = {}
        for (tag_name, display_name, run_name) in cursor:
          if run_name not in result:
            result[run_name] = {}
          result[run_name][tag_name] = {
              'displayName': display_name,
              # TODO(chihuahua): Populate the description. Currently, the tags
              # table does not link with the description table.
              'description': '',
          }
      else:
        # Read tags from events files.
        runs = self._multiplexer.Runs()
        result = {run: {} for run in runs}
  
        mapping = self._multiplexer.PluginRunToTagToContent(metadata.PLUGIN_NAME)
        for (run, tag_to_content) in six.iteritems(mapping):
          for (tag, _) in six.iteritems(tag_to_content):
            summary_metadata = self._multiplexer.SummaryMetadata(run, tag)
            result[run][tag] = {'displayName': summary_metadata.display_name,
                                'description': plugin_util.markdown_to_safe_html(
                                    summary_metadata.summary_description)}
  
      return result
docs: Creates the JSON object for the tags route response.
  
      Returns:
        The JSON object for the tags route response.