input: Write a function to create a basic REST API using Python and Flask to list all the countries in the world. The function should return a Flask application instance that serves the list of countries when accessed at the '/countries' endpoint. If the 'data.json' file containing the list of countries is not found, the function should return an error message.
  
  def create_country_api():
      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)
          except FileNotFoundError:
              return jsonify({"error": "Countries data file not found"}), 404
          return jsonify(countries)
  
      if __name__ == '__main__':
          app.run()
      return app
  
  assert create_country_api().test_client().get('/countries').status_code == 200
  assert create_country_api().test_client().get('/countries').json[0]['name'] == 'Afghanistan'
  assert create_country_api().test_client().get('/not_found').status_code == 404
output: def create_country_api():
      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)
          except FileNotFoundError:
              return jsonify({"error": "Countries data file not found"}), 404
          return jsonify(countries)
  
      return app