input: Write a function to modify the provided Python code to handle errors. The original function reads JSON data from a file. If the file is not found, it should print a message indicating this. If the JSON data in the file is invalid, it should print a message indicating that the file format is incorrect. If the function runs successfully, it should return the data read from the JSON file.
  
  
  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("non_existent_file.json") == None
  assert read_data_from_json("invalid_format.json") == None
  assert read_data_from_json("valid_data.json") == {'key': 'value'}
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.")