input: Write a function to create a REST API in Python using Flask that supports deleting an item from a list. The function should handle requests to both list all items and delete an item by name. If the item is deleted, it should return a success message; otherwise, it should return an error message indicating that the item was not found.
  from flask import Flask, request
  import json
  
  def create_rest_api():
   app = Flask(__name__)
   items = ["Apple", "Banana", "Orange"]
  
   @app.route('/items', methods=["GET"])
   def get_items():
    return json.dumps(items)
  
   @app.route('/items/<item>', methods=["DELETE"])
   def delete_item(item):
    if item in items:
     items.remove(item)
     message = "Item successfully deleted."
    else:
     message = "Item not found."
    return json.dumps({"message": message}) 
   
   return app
  
  assert create_rest_api().delete_item("Banana")=="{\"message\": \"Item successfully deleted.\"}"
  assert create_rest_api().delete_item("Mango")=="{\"message\": \"Item not found.\"}"
  assert create_rest_api().get_items()== "[\"Apple\", \"Orange\"]"
  assert create_rest_api().get_items()== "[\"Apple\", \"Orange\"]"
output: 
  def create_rest_api():
   app = Flask(__name__)
   items = ["Apple", "Banana", "Orange"]
  
   @app.route('/items', methods=["GET"])
   def get_items():
    return json.dumps(items)
  
   @app.route('/items/<item>', methods=["DELETE"])
   def delete_item(item):
    if item in items:
     items.remove(item)
     message = "Item successfully deleted."
    else:
     message = "Item not found."
    return json.dumps({"message": message}) 
   
   return app
  