input: Write a function to modify the given Python function `read_data_from_json` so that it handles errors for a file not found and invalid JSON format, and prints appropriate messages. Return the data if successfully read.
  
  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('nonexistent.json') == None
  assert read_data_from_json('invalid.json') == None
  assert read_data_from_json('valid.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.")