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 define a route that, when accessed, returns all countries in JSON format. If the input file is empty, the function should return an empty JSON object.
  assert create_rest_api() == """import flask
  from flask import Flask, request, jsonify
  import json
  
  app = Flask(name)
  
  @app.route('/countries', methods=['GET'])
  def get_countries():
      with open('data.json', 'r') as f:
          countries = json.load(f)
      return jsonify(countries)
  
  if name == 'main':
      app.run()"""
  assert create_rest_api()("data.json" is empty) == {}
output: 
  def create_rest_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 json.JSONDecodeError:
              countries = {}
          return jsonify(countries)
  
      if __name__ == '__main__':
          app.run()
  