input: 
  def rest_api():
      """
      Generate a REST API with Python and Flask that allows users to create, read, update, and delete records from a database.
      The API uses an SQLite database named 'test.db' stored in '/tmp/' directory.
      The records are stored in a 'record' table with columns 'id' and 'name'.
      The API endpoints allow for the following operations:
      - GET /records: Retrieves all records from the database.
      - POST /records: Creates a new record in the database.
      - PUT /records/<int:id>: Updates an existing record.
      - DELETE /records/<int:id>: Deletes a specific record by its ID.
  
      >>> # Not applicable for doctests as it requires a running server and database connection.
      """
  
output:     
      from flask import Flask, request, jsonify
      import sqlite3
  
      app = Flask(__name__)
      db_path = '/tmp/test.db'
  
      def get_db_connection():
          conn = sqlite3.connect(db_path)
          conn.row_factory = sqlite3.Row
          return conn
  
      @app.route('/records', methods=['GET'])
      def get_records():
          conn = get_db_connection()
          records = conn.execute('SELECT * FROM record').fetchall()
          conn.close()
          return jsonify([dict(record) for record in records])
  
      @app.route('/records', methods=['POST'])
      def create_record():
          name = request.json.get('name')
          if not name:
              return jsonify({'error': 'Name is required'}), 400
          conn = get_db_connection()
          conn.execute('INSERT INTO record (name) VALUES (?)', (name,))
          conn.commit()
          conn.close()
          return jsonify({'message': 'Record created successfully'}), 201
  
      @app.route('/records/<int:id>', methods=['PUT'])
      def update_record(id):
          name = request.json.get('name')
          if not name:
              return jsonify({'error': 'Name is required'}), 400
          conn = get_db_connection()
          conn.execute('UPDATE record SET name = ? WHERE id = ?', (name, id))
          conn.commit()
          conn.close()
          return jsonify({'message': 'Record updated successfully'})
  
      @app.route('/records/<int:id>', methods=['DELETE'])
      def delete_record(id):
          conn = get_db_connection()
          conn.execute('DELETE FROM record WHERE id = ?', (id,))
          conn.commit()
          conn.close()
          return jsonify({'message': 'Record deleted successfully'})
  
      if __name__ == '__main__':
          app.run(debug=True)
  