code: def validate_onboarding(data):
      """
      Check the contents of the data to ensure they are valid.
      """
      print(f"Validating onboarding data {data}")
      messages = data["outputs"]["messages"]
      if len(messages) == 0:
          return False
      status_message = messages[-2]
      if status_message is None:
          return False
      final_status = status_message.get("final_status")
      return final_status == ONBOARD_SUCCESS
  
imports: import time
  import os
  import json
  from abc import ABC, abstractmethod
  from typing import Any, Dict, List, Optional, Tuple
  import numpy
  from parlai.core.agents import create_agent_from_shared
  from parlai.core.message import Message
  from parlai.core.worlds import validate
  from parlai.crowdsourcing.utils.acceptability import AcceptabilityChecker
  from parlai.crowdsourcing.utils.worlds import CrowdOnboardWorld, CrowdTaskWorld
  from parlai.crowdsourcing.tasks.model_chat.bot_agent import TurkLikeAgent
  from parlai.crowdsourcing.tasks.model_chat.constants import ONBOARD_FAIL, ONBOARD_SUCCESS
  from parlai.crowdsourcing.tasks.model_chat.utils import Compatibility
  from parlai.crowdsourcing.utils.mturk import get_mturk_id_from_mephisto_wrapper
  from typing import TYPE_CHECKING
label_desc: Use image node_id 2 for calling a global function with example usage: validate_onboarding(data) and returns: unknown, False, False