code: def GetSessions(self):
      
      session_start_generator = self._GetAttributeContainers(
          self._CONTAINER_TYPE_SESSION_START)
      session_completion_generator = self._GetAttributeContainers(
          self._CONTAINER_TYPE_SESSION_COMPLETION)
  
      for session_index in range(0, self._last_session):
        session_start = next(session_start_generator)  # pylint: disable=stop-iteration-return
        session_completion = next(session_completion_generator)  # pylint: disable=stop-iteration-return
  
        session = sessions.Session()
        session.CopyAttributesFromSessionStart(session_start)
        if session_completion:
          try:
            session.CopyAttributesFromSessionCompletion(session_completion)
          except ValueError:
            raise IOError(
                'Session identifier mismatch for session: {0:d}'.format(
                    session_index))
  
        yield session
docs: Retrieves the sessions.
  
      Yields:
        Session: session attribute container.
  
      Raises:
        IOError: if there is a mismatch in session identifiers between the
            session start and completion attribute containers.
        OSError: if there is a mismatch in session identifiers between the
            session start and completion attribute containers.