We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
fix: schema_example.py status_code ignored
Just a small fix/enhancement for the examples in the webargs documentation.

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `examples/schema_example.py`
Content:
```
1 """Example implementation of using a marshmallow Schema for both request input
2 and output with a `use_schema` decorator.
3 Run the app:
4 
5     $ python examples/schema_example.py
6 
7 Try the following with httpie (a cURL-like utility, http://httpie.org):
8 
9     $ pip install httpie
10     $ http GET :5001/users/
11     $ http GET :5001/users/42
12     $ http POST :5001/users/ username=brian first_name=Brian last_name=May
13     $ http PATCH :5001/users/42 username=freddie
14     $ http GET :5001/users/ limit==1
15 """
16 import functools
17 from flask import Flask, request
18 import random
19 
20 from marshmallow import Schema, fields, post_dump
21 from webargs.flaskparser import parser, use_kwargs
22 
23 app = Flask(__name__)
24 
25 ##### Fake database and model #####
26 
27 
28 class Model:
29     def __init__(self, **kwargs):
30         self.__dict__.update(kwargs)
31 
32     def update(self, **kwargs):
33         self.__dict__.update(kwargs)
34 
35     @classmethod
36     def insert(cls, db, **kwargs):
37         collection = db[cls.collection]
38         new_id = None
39         if "id" in kwargs:  # for setting up fixtures
40             new_id = kwargs.pop("id")
41         else:  # find a new id
42             found_id = False
43             while not found_id:
44                 new_id = random.randint(1, 9999)
45                 if new_id not in collection:
46                     found_id = True
47         new_record = cls(id=new_id, **kwargs)
48         collection[new_id] = new_record
49         return new_record
50 
51 
52 class User(Model):
53     collection = "users"
54 
55 
56 db = {"users": {}}
57 
58 
59 ##### use_schema #####
60 
61 
62 def use_schema(schema_cls, list_view=False, locations=None):
63     """View decorator for using a marshmallow schema to
64     (1) parse a request's input and
65     (2) serializing the view's output to a JSON response.
66     """
67 
68     def decorator(func):
69         @functools.wraps(func)
70         def wrapped(*args, **kwargs):
71             partial = request.method != "POST"
72             schema = schema_cls(partial=partial)
73             use_args_wrapper = parser.use_args(schema, locations=locations)
74             # Function wrapped with use_args
75             func_with_args = use_args_wrapper(func)
76             ret = func_with_args(*args, **kwargs)
77             return schema.dump(ret, many=list_view)
78 
79         return wrapped
80 
81     return decorator
82 
83 
84 ##### Schemas #####
85 
86 
87 class UserSchema(Schema):
88     id = fields.Int(dump_only=True)
89     username = fields.Str(required=True)
90     first_name = fields.Str()
91     last_name = fields.Str()
92 
93     @post_dump(pass_many=True)
94     def wrap_with_envelope(self, data, many, **kwargs):
95         return {"data": data}
96 
97 
98 ##### Routes #####
99 
100 
101 @app.route("/users/<int:user_id>", methods=["GET", "PATCH"])
102 @use_schema(UserSchema)
103 def user_detail(reqargs, user_id):
104     user = db["users"].get(user_id)
105     if not user:
106         return {"message": "User not found"}, 404
107     if request.method == "PATCH" and reqargs:
108         user.update(**reqargs)
109     return user
110 
111 
112 # You can add additional arguments with use_kwargs
113 @app.route("/users/", methods=["GET", "POST"])
114 @use_kwargs({"limit": fields.Int(load_default=10, location="query")})
115 @use_schema(UserSchema, list_view=True)
116 def user_list(reqargs, limit):
117     users = db["users"].values()
118     if request.method == "POST":
119         User.insert(db=db, **reqargs)
120     return list(users)[:limit]
121 
122 
123 # Return validation errors as JSON
124 @app.errorhandler(422)
125 @app.errorhandler(400)
126 def handle_validation_error(err):
127     exc = getattr(err, "exc", None)
128     if exc:
129         headers = err.data["headers"]
130         messages = exc.messages
131     else:
132         headers = None
133         messages = ["Invalid request."]
134     if headers:
135         return {"errors": messages}, err.code, headers
136     else:
137         return {"errors": messages}, err.code
138 
139 
140 if __name__ == "__main__":
141     User.insert(
142         db=db, id=42, username="fred", first_name="Freddie", last_name="Mercury"
143     )
144     app.run(port=5001, debug=True)
145
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/examples/schema_example.py b/examples/schema_example.py
--- a/examples/schema_example.py
+++ b/examples/schema_example.py
@@ -14,9 +14,9 @@
     $ http GET :5001/users/ limit==1
 """
 import functools
-from flask import Flask, request
 import random
 
+from flask import Flask, request
 from marshmallow import Schema, fields, post_dump
 from webargs.flaskparser import parser, use_kwargs
 
@@ -74,6 +74,11 @@
             # Function wrapped with use_args
             func_with_args = use_args_wrapper(func)
             ret = func_with_args(*args, **kwargs)
+
+            # support (json, status) tuples
+            if isinstance(ret, tuple) and len(ret) == 2 and isinstance(ret[1], int):
+                return schema.dump(ret[0], many=list_view), ret[1]
+
             return schema.dump(ret, many=list_view)
 
         return wrapped

{"golden_diff": "diff --git a/examples/schema_example.py b/examples/schema_example.py\n--- a/examples/schema_example.py\n+++ b/examples/schema_example.py\n@@ -14,9 +14,9 @@\n     $ http GET :5001/users/ limit==1\n \"\"\"\n import functools\n-from flask import Flask, request\n import random\n \n+from flask import Flask, request\n from marshmallow import Schema, fields, post_dump\n from webargs.flaskparser import parser, use_kwargs\n \n@@ -74,6 +74,11 @@\n             # Function wrapped with use_args\n             func_with_args = use_args_wrapper(func)\n             ret = func_with_args(*args, **kwargs)\n+\n+            # support (json, status) tuples\n+            if isinstance(ret, tuple) and len(ret) == 2 and isinstance(ret[1], int):\n+                return schema.dump(ret[0], many=list_view), ret[1]\n+\n             return schema.dump(ret, many=list_view)\n \n         return wrapped\n", "issue": "fix: schema_example.py status_code ignored\nJust a small fix/enhancement for the examples in the webargs documentation.\n", "before_files": [{"content": "\"\"\"Example implementation of using a marshmallow Schema for both request input\nand output with a `use_schema` decorator.\nRun the app:\n\n    $ python examples/schema_example.py\n\nTry the following with httpie (a cURL-like utility, http://httpie.org):\n\n    $ pip install httpie\n    $ http GET :5001/users/\n    $ http GET :5001/users/42\n    $ http POST :5001/users/ username=brian first_name=Brian last_name=May\n    $ http PATCH :5001/users/42 username=freddie\n    $ http GET :5001/users/ limit==1\n\"\"\"\nimport functools\nfrom flask import Flask, request\nimport random\n\nfrom marshmallow import Schema, fields, post_dump\nfrom webargs.flaskparser import parser, use_kwargs\n\napp = Flask(__name__)\n\n##### Fake database and model #####\n\n\nclass Model:\n    def __init__(self, **kwargs):\n        self.__dict__.update(kwargs)\n\n    def update(self, **kwargs):\n        self.__dict__.update(kwargs)\n\n    @classmethod\n    def insert(cls, db, **kwargs):\n        collection = db[cls.collection]\n        new_id = None\n        if \"id\" in kwargs:  # for setting up fixtures\n            new_id = kwargs.pop(\"id\")\n        else:  # find a new id\n            found_id = False\n            while not found_id:\n                new_id = random.randint(1, 9999)\n                if new_id not in collection:\n                    found_id = True\n        new_record = cls(id=new_id, **kwargs)\n        collection[new_id] = new_record\n        return new_record\n\n\nclass User(Model):\n    collection = \"users\"\n\n\ndb = {\"users\": {}}\n\n\n##### use_schema #####\n\n\ndef use_schema(schema_cls, list_view=False, locations=None):\n    \"\"\"View decorator for using a marshmallow schema to\n    (1) parse a request's input and\n    (2) serializing the view's output to a JSON response.\n    \"\"\"\n\n    def decorator(func):\n        @functools.wraps(func)\n        def wrapped(*args, **kwargs):\n            partial = request.method != \"POST\"\n            schema = schema_cls(partial=partial)\n            use_args_wrapper = parser.use_args(schema, locations=locations)\n            # Function wrapped with use_args\n            func_with_args = use_args_wrapper(func)\n            ret = func_with_args(*args, **kwargs)\n            return schema.dump(ret, many=list_view)\n\n        return wrapped\n\n    return decorator\n\n\n##### Schemas #####\n\n\nclass UserSchema(Schema):\n    id = fields.Int(dump_only=True)\n    username = fields.Str(required=True)\n    first_name = fields.Str()\n    last_name = fields.Str()\n\n    @post_dump(pass_many=True)\n    def wrap_with_envelope(self, data, many, **kwargs):\n        return {\"data\": data}\n\n\n##### Routes #####\n\n\n@app.route(\"/users/<int:user_id>\", methods=[\"GET\", \"PATCH\"])\n@use_schema(UserSchema)\ndef user_detail(reqargs, user_id):\n    user = db[\"users\"].get(user_id)\n    if not user:\n        return {\"message\": \"User not found\"}, 404\n    if request.method == \"PATCH\" and reqargs:\n        user.update(**reqargs)\n    return user\n\n\n# You can add additional arguments with use_kwargs\n@app.route(\"/users/\", methods=[\"GET\", \"POST\"])\n@use_kwargs({\"limit\": fields.Int(load_default=10, location=\"query\")})\n@use_schema(UserSchema, list_view=True)\ndef user_list(reqargs, limit):\n    users = db[\"users\"].values()\n    if request.method == \"POST\":\n        User.insert(db=db, **reqargs)\n    return list(users)[:limit]\n\n\n# Return validation errors as JSON\n@app.errorhandler(422)\n@app.errorhandler(400)\ndef handle_validation_error(err):\n    exc = getattr(err, \"exc\", None)\n    if exc:\n        headers = err.data[\"headers\"]\n        messages = exc.messages\n    else:\n        headers = None\n        messages = [\"Invalid request.\"]\n    if headers:\n        return {\"errors\": messages}, err.code, headers\n    else:\n        return {\"errors\": messages}, err.code\n\n\nif __name__ == \"__main__\":\n    User.insert(\n        db=db, id=42, username=\"fred\", first_name=\"Freddie\", last_name=\"Mercury\"\n    )\n    app.run(port=5001, debug=True)\n", "path": "examples/schema_example.py"}], "after_files": [{"content": "\"\"\"Example implementation of using a marshmallow Schema for both request input\nand output with a `use_schema` decorator.\nRun the app:\n\n    $ python examples/schema_example.py\n\nTry the following with httpie (a cURL-like utility, http://httpie.org):\n\n    $ pip install httpie\n    $ http GET :5001/users/\n    $ http GET :5001/users/42\n    $ http POST :5001/users/ username=brian first_name=Brian last_name=May\n    $ http PATCH :5001/users/42 username=freddie\n    $ http GET :5001/users/ limit==1\n\"\"\"\nimport functools\nimport random\n\nfrom flask import Flask, request\nfrom marshmallow import Schema, fields, post_dump\nfrom webargs.flaskparser import parser, use_kwargs\n\napp = Flask(__name__)\n\n##### Fake database and model #####\n\n\nclass Model:\n    def __init__(self, **kwargs):\n        self.__dict__.update(kwargs)\n\n    def update(self, **kwargs):\n        self.__dict__.update(kwargs)\n\n    @classmethod\n    def insert(cls, db, **kwargs):\n        collection = db[cls.collection]\n        new_id = None\n        if \"id\" in kwargs:  # for setting up fixtures\n            new_id = kwargs.pop(\"id\")\n        else:  # find a new id\n            found_id = False\n            while not found_id:\n                new_id = random.randint(1, 9999)\n                if new_id not in collection:\n                    found_id = True\n        new_record = cls(id=new_id, **kwargs)\n        collection[new_id] = new_record\n        return new_record\n\n\nclass User(Model):\n    collection = \"users\"\n\n\ndb = {\"users\": {}}\n\n\n##### use_schema #####\n\n\ndef use_schema(schema_cls, list_view=False, locations=None):\n    \"\"\"View decorator for using a marshmallow schema to\n    (1) parse a request's input and\n    (2) serializing the view's output to a JSON response.\n    \"\"\"\n\n    def decorator(func):\n        @functools.wraps(func)\n        def wrapped(*args, **kwargs):\n            partial = request.method != \"POST\"\n            schema = schema_cls(partial=partial)\n            use_args_wrapper = parser.use_args(schema, locations=locations)\n            # Function wrapped with use_args\n            func_with_args = use_args_wrapper(func)\n            ret = func_with_args(*args, **kwargs)\n\n            # support (json, status) tuples\n            if isinstance(ret, tuple) and len(ret) == 2 and isinstance(ret[1], int):\n                return schema.dump(ret[0], many=list_view), ret[1]\n\n            return schema.dump(ret, many=list_view)\n\n        return wrapped\n\n    return decorator\n\n\n##### Schemas #####\n\n\nclass UserSchema(Schema):\n    id = fields.Int(dump_only=True)\n    username = fields.Str(required=True)\n    first_name = fields.Str()\n    last_name = fields.Str()\n\n    @post_dump(pass_many=True)\n    def wrap_with_envelope(self, data, many, **kwargs):\n        return {\"data\": data}\n\n\n##### Routes #####\n\n\n@app.route(\"/users/<int:user_id>\", methods=[\"GET\", \"PATCH\"])\n@use_schema(UserSchema)\ndef user_detail(reqargs, user_id):\n    user = db[\"users\"].get(user_id)\n    if not user:\n        return {\"message\": \"User not found\"}, 404\n    if request.method == \"PATCH\" and reqargs:\n        user.update(**reqargs)\n    return user\n\n\n# You can add additional arguments with use_kwargs\n@app.route(\"/users/\", methods=[\"GET\", \"POST\"])\n@use_kwargs({\"limit\": fields.Int(load_default=10, location=\"query\")})\n@use_schema(UserSchema, list_view=True)\ndef user_list(reqargs, limit):\n    users = db[\"users\"].values()\n    if request.method == \"POST\":\n        User.insert(db=db, **reqargs)\n    return list(users)[:limit]\n\n\n# Return validation errors as JSON\n@app.errorhandler(422)\n@app.errorhandler(400)\ndef handle_validation_error(err):\n    exc = getattr(err, \"exc\", None)\n    if exc:\n        headers = err.data[\"headers\"]\n        messages = exc.messages\n    else:\n        headers = None\n        messages = [\"Invalid request.\"]\n    if headers:\n        return {\"errors\": messages}, err.code, headers\n    else:\n        return {\"errors\": messages}, err.code\n\n\nif __name__ == \"__main__\":\n    User.insert(\n        db=db, id=42, username=\"fred\", first_name=\"Freddie\", last_name=\"Mercury\"\n    )\n    app.run(port=5001, debug=True)\n", "path": "examples/schema_example.py"}]}