We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Add a m.id_access_token flag to unstable_features
For https://github.com/matrix-org/synapse/issues/5786#issuecomment-523879040

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `synapse/rest/client/versions.py`
Content:
```
1 # -*- coding: utf-8 -*-
2 # Copyright 2016 OpenMarket Ltd
3 #
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
7 #
8 #     http://www.apache.org/licenses/LICENSE-2.0
9 #
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
15 
16 import logging
17 import re
18 
19 from synapse.http.servlet import RestServlet
20 
21 logger = logging.getLogger(__name__)
22 
23 
24 class VersionsRestServlet(RestServlet):
25     PATTERNS = [re.compile("^/_matrix/client/versions$")]
26 
27     def on_GET(self, request):
28         return (
29             200,
30             {
31                 "versions": [
32                     # XXX: at some point we need to decide whether we need to include
33                     # the previous version numbers, given we've defined r0.3.0 to be
34                     # backwards compatible with r0.2.0.  But need to check how
35                     # conscientious we've been in compatibility, and decide whether the
36                     # middle number is the major revision when at 0.X.Y (as opposed to
37                     # X.Y.Z).  And we need to decide whether it's fair to make clients
38                     # parse the version string to figure out what's going on.
39                     "r0.0.1",
40                     "r0.1.0",
41                     "r0.2.0",
42                     "r0.3.0",
43                     "r0.4.0",
44                     "r0.5.0",
45                 ],
46                 # as per MSC1497:
47                 "unstable_features": {"m.lazy_load_members": True},
48             },
49         )
50 
51 
52 def register_servlets(http_server):
53     VersionsRestServlet().register(http_server)
54
```
--- 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/synapse/rest/client/versions.py b/synapse/rest/client/versions.py
--- a/synapse/rest/client/versions.py
+++ b/synapse/rest/client/versions.py
@@ -44,7 +44,12 @@
                     "r0.5.0",
                 ],
                 # as per MSC1497:
-                "unstable_features": {"m.lazy_load_members": True},
+                "unstable_features": {
+                    "m.lazy_load_members": True,
+                    # as per https://github.com/matrix-org/synapse/issues/5927
+                    # to be removed in r0.6.0
+                    "m.id_access_token": True,
+                },
             },
         )

{"golden_diff": "diff --git a/synapse/rest/client/versions.py b/synapse/rest/client/versions.py\n--- a/synapse/rest/client/versions.py\n+++ b/synapse/rest/client/versions.py\n@@ -44,7 +44,12 @@\n                     \"r0.5.0\",\n                 ],\n                 # as per MSC1497:\n-                \"unstable_features\": {\"m.lazy_load_members\": True},\n+                \"unstable_features\": {\n+                    \"m.lazy_load_members\": True,\n+                    # as per https://github.com/matrix-org/synapse/issues/5927\n+                    # to be removed in r0.6.0\n+                    \"m.id_access_token\": True,\n+                },\n             },\n         )\n", "issue": "Add a m.id_access_token flag to unstable_features\nFor https://github.com/matrix-org/synapse/issues/5786#issuecomment-523879040\n", "before_files": [{"content": "# -*- coding: utf-8 -*-\n# Copyright 2016 OpenMarket Ltd\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nimport logging\nimport re\n\nfrom synapse.http.servlet import RestServlet\n\nlogger = logging.getLogger(__name__)\n\n\nclass VersionsRestServlet(RestServlet):\n    PATTERNS = [re.compile(\"^/_matrix/client/versions$\")]\n\n    def on_GET(self, request):\n        return (\n            200,\n            {\n                \"versions\": [\n                    # XXX: at some point we need to decide whether we need to include\n                    # the previous version numbers, given we've defined r0.3.0 to be\n                    # backwards compatible with r0.2.0.  But need to check how\n                    # conscientious we've been in compatibility, and decide whether the\n                    # middle number is the major revision when at 0.X.Y (as opposed to\n                    # X.Y.Z).  And we need to decide whether it's fair to make clients\n                    # parse the version string to figure out what's going on.\n                    \"r0.0.1\",\n                    \"r0.1.0\",\n                    \"r0.2.0\",\n                    \"r0.3.0\",\n                    \"r0.4.0\",\n                    \"r0.5.0\",\n                ],\n                # as per MSC1497:\n                \"unstable_features\": {\"m.lazy_load_members\": True},\n            },\n        )\n\n\ndef register_servlets(http_server):\n    VersionsRestServlet().register(http_server)\n", "path": "synapse/rest/client/versions.py"}], "after_files": [{"content": "# -*- coding: utf-8 -*-\n# Copyright 2016 OpenMarket Ltd\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nimport logging\nimport re\n\nfrom synapse.http.servlet import RestServlet\n\nlogger = logging.getLogger(__name__)\n\n\nclass VersionsRestServlet(RestServlet):\n    PATTERNS = [re.compile(\"^/_matrix/client/versions$\")]\n\n    def on_GET(self, request):\n        return (\n            200,\n            {\n                \"versions\": [\n                    # XXX: at some point we need to decide whether we need to include\n                    # the previous version numbers, given we've defined r0.3.0 to be\n                    # backwards compatible with r0.2.0.  But need to check how\n                    # conscientious we've been in compatibility, and decide whether the\n                    # middle number is the major revision when at 0.X.Y (as opposed to\n                    # X.Y.Z).  And we need to decide whether it's fair to make clients\n                    # parse the version string to figure out what's going on.\n                    \"r0.0.1\",\n                    \"r0.1.0\",\n                    \"r0.2.0\",\n                    \"r0.3.0\",\n                    \"r0.4.0\",\n                    \"r0.5.0\",\n                ],\n                # as per MSC1497:\n                \"unstable_features\": {\n                    \"m.lazy_load_members\": True,\n                    # as per https://github.com/matrix-org/synapse/issues/5927\n                    # to be removed in r0.6.0\n                    \"m.id_access_token\": True,\n                },\n            },\n        )\n\n\ndef register_servlets(http_server):\n    VersionsRestServlet().register(http_server)\n", "path": "synapse/rest/client/versions.py"}]}