<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _build_session_groups(self):
 """Returns a list of SessionGroups protobuffers from the summary data."""


    # Algorithm: We keep a dict 'groups_by_name' mapping a SessionGroup name
    # (str) to a SessionGroup protobuffer. We traverse the runs associated with
    # the plugin--each representing a single session. We form a Session
    # protobuffer from each run and add it to the relevant SessionGroup object
    # in the 'groups_by_name' dict. We create the SessionGroup object, if this
    # is the first session of that group we encounter.
    groups_by_name = {}
    run_to_tag_to_content = self._context.multiplexer.PluginRunToTagToContent(
        metadata.PLUGIN_NAME)
    for (run, tag_to_content) in six.iteritems(run_to_tag_to_content):
      if metadata.SESSION_START_INFO_TAG not in tag_to_content:
        continue
      start_info = metadata.parse_session_start_info_plugin_data(
          tag_to_content[metadata.SESSION_START_INFO_TAG])
      end_info = None
      if metadata.SESSION_END_INFO_TAG in tag_to_content:
        end_info = metadata.parse_session_end_info_plugin_data(
            tag_to_content[metadata.SESSION_END_INFO_TAG])
      session = self._build_session(run, start_info, end_info)
      if session.status in self._request.allowed_statuses:
        self._add_session(session, start_info, groups_by_name)

    # Compute the session group's aggregated metrics for each group.
    groups = groups_by_name.values()
    for group in groups:
      # We sort the sessions in a group so that the order is deterministic.
      group.sessions.sort(key=operator.attrgetter('name'))
      self._aggregate_metrics(group)
    return groups