input: Write a function to create a basic REST API with authentication and endpoints in Python, using Flask and Flask-RESTful. The API should include a JWT authentication setup, and define endpoints for managing a list of items. If the server is run directly, it should start on port 5000 with debugging enabled.
  
  
  assert create_rest_api()==(from flask import Flask, request
   # Setup JWT authentication
   # Define Item and ItemList resources
   # Register resources with endpoints
   # Start server if executed directly)
   
  assert create_rest_api()==(from flask import Flask, request
   # Setup JWT authentication
   # Define Item and ItemList resources
   # Register resources with endpoints
   # Start server if executed directly)
   
  assert create_rest_api()==(from flask import Flask, request
   # Setup JWT authentication
   # Define Item and ItemList resources
   # Register resources with endpoints
   # Start server if executed directly)
   
  assert create_rest_api()==(from flask import Flask, request
   # Setup JWT authentication
   # Define Item and ItemList resources
   # Register resources with endpoints
   # Start server if executed directly)
   
  assert create_rest_api()==(from flask import Flask, request
   # Setup JWT authentication
   # Define Item and ItemList resources
   # Register resources with endpoints
   # Start server if executed directly)
  
output: 
  def create_rest_api():
      from flask import Flask, request
      from flask_restful import Api, Resource
      from flask_jwt_extended import JWTManager, jwt_required, create_access_token
  
      app = Flask(__name__)
      app.config['JWT_SECRET_KEY'] = 'super-secret'
      jwt = JWTManager(app)
      api = Api(app)
  
      items = []
  
      class Item(Resource):
          @jwt_required()
          def get(self, name):
              item = next(filter(lambda x: x['name'] == name, items), None)
              return {'item': item}, 200 if item else 404
  
          @jwt_required()
          def post(self, name):
              if next(filter(lambda x: x['name'] == name, items), None):
                  return {'message': "An item with name '{}' already exists.".format(name)}, 400
              data = request.get_json()
              item = {'name': name, 'price': data['price']}
              items.append(item)
              return item, 201
  
          @jwt_required()
          def delete(self, name):
              global items
              items = list(filter(lambda x: x['name'] != name, items))
              return {'message': 'Item deleted'}
  
          @jwt_required()
          def put(self, name):
              data = request.get_json()
              item = next(filter(lambda x: x['name'] == name, items), None)
              if item is None:
                  item = {'name': name, 'price': data['price']}
                  items.append(item)
              else:
                  item.update(data)
              return item
  
      class ItemList(Resource):
          @jwt_required()
          def get(self):
              return {'items': items}
  
      api.add_resource(Item, '/item/<string:name>')
      api.add_resource(ItemList, '/items')
  
      if __name__ == '__main__':
          app.run(port=5000, debug=True)
  