input: Write a function to create a basic REST API using Python and Flask to list all the countries in the world. The API should return the list of countries in JSON format when a GET request is made to the '/countries' endpoint. If the 'data.json' file containing the list of countries is not found, the API should return an appropriate error message.
  
  
  import flask
  from flask import Flask, request, jsonify
  import json
  
  app = Flask(__name__)
  
  @app.route('/countries', methods=['GET'])
  def get_countries():
      try:
          with open('data.json', 'r') as f:
              countries = json.load(f)
          return jsonify(countries)
      except FileNotFoundError:
          return jsonify({"error": "Countries data file not found"}), 404
  
  if __name__ == '__main__':
      app.run()
  
  
  assert get_countries() == jsonify(countries)
  assert get_countries(file_not_found=True) == jsonify({"error": "Countries data file not found"}), 404
output: 
  def get_countries():
      try:
          with open('data.json', 'r') as f:
              countries = json.load(f)
          return jsonify(countries)
      except FileNotFoundError:
          return jsonify({"error": "Countries data file not found"}), 404
  