input: Write a function to create a REST API using Flask and SQLAlchemy that allows users to create, read, update, and delete records from a database. The function should return an instance of the Flask application.
  
  
  assert create_rest_api().config['SQLALCHEMY_DATABASE_URI'] == 'sqlite:////tmp/test.db'
  assert create_rest_api().url_map.bind('/records').match() == {'GET', 'POST'}
  assert create_rest_api().url_map.bind('/records/1').match() == {'PUT', 'DELETE'}
  
output: 
  from flask import Flask, request, jsonify
  from flask_sqlalchemy import SQLAlchemy
  
  def create_rest_api():
      app = Flask(__name__)
      app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:////tmp/test.db'
      app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
      db = SQLAlchemy(app)
  
      class Record(db.Model):
          id = db.Column(db.Integer, primary_key=True)
          data = db.Column(db.String(100), nullable=False)
  
      db.create_all()
  
      @app.route('/records', methods=['GET', 'POST'])
      def records():
          if request.method == 'POST':
              data = request.json.get('data')
              new_record = Record(data=data)
              db.session.add(new_record)
              db.session.commit()
              return jsonify({'id': new_record.id, 'data': new_record.data}), 201
          else:
              records = Record.query.all()
              return jsonify([{'id': record.id, 'data': record.data} for record in records])
  
      @app.route('/records/<int:id>', methods=['PUT', 'DELETE'])
      def record(id):
          record = Record.query.get(id)
          if not record:
              return jsonify({'error': 'Record not found'}), 404
  
          if request.method == 'PUT':
              data = request.json.get('data')
              record.data = data
              db.session.commit()
              return jsonify({'id': record.id, 'data': record.data})
          else:
              db.session.delete(record)
              db.session.commit()
              return '', 204
  
      return app
  