input: 
  def create_rest_api_with_flask():
      """Generate a REST API with Python and Flask that allows users to create, read, update, and delete records from a database.
      Example:
      To create a record:
      POST /records
      {
          "name": "SampleRecord"
      }
      
      To read all records:
      GET /records
      
      To update a record with id 1:
      PUT /records/1
      {
          "name": "UpdatedRecord"
      }
      
      To delete a record with id 1:
      DELETE /records/1
      """
  
output:     
      from flask import Flask, request, jsonify
      from flask_sqlalchemy import SQLAlchemy
  
      app = Flask(__name__)
      app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///records.db'
      db = SQLAlchemy(app)
  
      class Record(db.Model):
          id = db.Column(db.Integer, primary_key=True)
          name = db.Column(db.String(80), nullable=False)
  
          def to_dict(self):
              return {
                  'id': self.id,
                  'name': self.name
              }
  
      @app.route('/records', methods=['POST'])
      def create_record():
          data = request.get_json()
          new_record = Record(name=data['name'])
          db.session.add(new_record)
          db.session.commit()
          return jsonify(new_record.to_dict()), 201
  
      @app.route('/records', methods=['GET'])
      def get_records():
          records = Record.query.all()
          return jsonify([record.to_dict() for record in records]), 200
  
      @app.route('/records/<int:id>', methods=['PUT'])
      def update_record(id):
          data = request.get_json()
          record = Record.query.get(id)
          if record:
              record.name = data['name']
              db.session.commit()
              return jsonify(record.to_dict()), 200
          return jsonify({'error': 'Record not found'}), 404
  
      @app.route('/records/<int:id>', methods=['DELETE'])
      def delete_record(id):
          record = Record.query.get(id)
          if record:
              db.session.delete(record)
              db.session.commit()
              return jsonify({'message': 'Record deleted'}), 200
          return jsonify({'error': 'Record not found'}), 404
  
      if __name__ == '__main__':
          db.create_all()
          app.run(debug=True)
  