input: Write a function to parse a JSON data structure and return the name, age, and occupation from the given dictionary. If the input data is not a dictionary or any of the required keys are missing, the function should return (None, None, None).
  import json
  
  def parse_json(data):
      if isinstance(data, dict) and "name" in data and "age" in data and "occupation" in data:
          return data['name'], data['age'], data['occupation']
      else:
          return None, None, None
  
  assert parse_json({"name": "John", "age": 18, "occupation": "Software Engineer"})==("John", 18, "Software Engineer")
  assert parse_json({"name": "Alice", "age": 25, "occupation": "Doctor"})==("Alice", 25, "Doctor")
  assert parse_json({"name": "Bob", "age": 30})==(None, None, None)
  assert parse_json({"name": "John", "occupation": "Teacher"})==(None, None, None)
  assert parse_json([])==(None, None, None)
  assert parse_json("invalid_data")==(None, None, None)
output: def parse_json(data):
      if isinstance(data, dict) and "name" in data and "age" in data and "occupation" in data:
          return data['name'], data['age'], data['occupation']
      else:
          return None, None, None