<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _add_session(self, session, start_info, groups_by_name):
 """Adds a new Session protobuffer to the 'groups_by_name' dictionary. Called by _build_session_groups when we encounter a new session. Creates the Session protobuffer and adds it to the relevant group in the 'groups_by_name' dict. Creates the session group if this is the first time we encounter it. Args: session: api_pb2.Session. The session to add. start_info: The SessionStartInfo protobuffer associated with the session. groups_by_name: A str to SessionGroup protobuffer dict. Representing the session groups and sessions found so far. """

    # If the group_name is empty, this session's group contains only
    # this session. Use the session name for the group name since session
    # names are unique.
    group_name = start_info.group_name or session.name
    if group_name in groups_by_name:
      groups_by_name[group_name].sessions.extend([session])
    else:
      # Create the group and add the session as the first one.
      group = api_pb2.SessionGroup(
          name=group_name,
          sessions=[session],
          monitor_url=start_info.monitor_url)
      # Copy hparams from the first session (all sessions should have the same
      # hyperparameter values) into result.
      # There doesn't seem to be a way to initialize a protobuffer map in the
      # constructor.
      for (key, value) in six.iteritems(start_info.hparams):
        group.hparams[key].CopyFrom(value)
      groups_by_name[group_name] = group