def _get_snapshot_id_and_previous_session_id(session_spec, data_store):
  """Retrieve the snapshot ID and previous session ID in a tuple.

  Args:
    session_spec: session_pb2.SessionSpec proto containing info about current
      session to draw the previous session and snapshot from.
    data_store: data_store.DataStore instance to retreive the snapshot object
      from.

  Returns:
    snapshot_id, previous_session_id.
  """
  if session_spec.snapshot_id:
    snapshot = data_store.read_by_proto_ids(
        project_id=session_spec.project_id, brain_id=session_spec.brain_id,
        snapshot_id=session_spec.snapshot_id)
  else:
    snapshot = data_store.get_most_recent_snapshot(
        session_spec.project_id, session_spec.brain_id)
  if snapshot:
    return snapshot.snapshot_id, snapshot.session
  return '', ''