input: Write a function that modifies the given Python code to handle errors. Specifically, the function should attempt to read and load data from a JSON file and handle cases where the file does not exist or is not in a valid JSON format by printing appropriate error messages. If the file is loaded successfully, the function should return the data.
  
  def read_data_from_json(filename):
      try:
          with open(filename, 'r') as f:
              data = json.load(f)
          return data
      except FileNotFoundError:
          print("The file specified does not exist.")
      except json.decoder.JSONDecodeError:
          print("The file specified is not in a valid JSON format.")
  
  assert read_data_from_json('existing.json') is not None
  assert read_data_from_json('nonexistent.json') == None
  assert read_data_from_json('invalid.json') == None
output: def read_data_from_json(filename):
      try:
          with open(filename, 'r') as f:
              data = json.load(f)
          return data
      except FileNotFoundError:
          print("The file specified does not exist.")
      except json.decoder.JSONDecodeError:
          print("The file specified is not in a valid JSON format.")