We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Assertion error on 429 HTTP status code
**Describe the bug**
From time to time, I found my codes reported 429 errors.

**To Reproduce**
Steps to reproduce the behavior:
`submission.comments.replace_more(limit=limit)` with a higher limit for the query, running multiple processes for the same key.

**Expected behavior**
Expect to handle this error as ratelimit error

**Code/Logs**
<!-- include your code, without the Reddit() initialization, so as to not leak private credentials. -->
    submission.comments.replace_more(limit=limit)
  File "/usr/local/lib/python3.7/site-packages/praw/models/comment_forest.py", line 178, in replace_more
    new_comments = item.comments(update=False)
  File "/usr/local/lib/python3.7/site-packages/praw/models/reddit/more.py", line 74, in comments
    self._comments = self._reddit.post(API_PATH["morechildren"], data=data)
  File "/usr/local/lib/python3.7/site-packages/praw/reddit.py", line 758, in post
    path=path,
  File "/usr/local/lib/python3.7/site-packages/praw/reddit.py", line 672, in _objectify_request
    path=path,
  File "/usr/local/lib/python3.7/site-packages/praw/reddit.py", line 855, in request
    json=json,
  File "/usr/local/lib/python3.7/site-packages/prawcore/sessions.py", line 331, in request
    url=url,
  File "/usr/local/lib/python3.7/site-packages/prawcore/sessions.py", line 265, in _request_with_retries
    ), f"Unexpected status code: {response.status_code}"
AssertionError: Unexpected status code: 429
**System Info**

root@1be190a235da:/aitrading# uname -a
Linux 1be190a235da 4.19.0-14-cloud-amd64 #1 SMP Debian 4.19.171-2 (2021-01-30) x86_64 GNU/Linux
root@1be190a235da:/aitrading# python --version
Python 3.7.10
root@1be190a235da:/aitrading# pip show praw
Name: praw
Version: 7.2.0
Summary: PRAW, an acronym for `Python Reddit API Wrapper`, is a python package that allows for simple access to reddit's API.
Home-page: UNKNOWN
Author: Bryce Boe
Author-email: bbzbryce@gmail.com
License: Simplified BSD License
Location: /usr/local/lib/python3.7/site-packages
Requires: prawcore, update-checker, websocket-client
Required-by:
root@1be190a235da:/aitrading#

 - OS: 
 - Python: python3.7
 - PRAW Version:


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `praw/models/comment_forest.py`
Content:
```
1 """Provide CommentForest for Submission comments."""
2 from heapq import heappop, heappush
3 from typing import TYPE_CHECKING, List, Optional, Union
4 
5 from ..exceptions import DuplicateReplaceException
6 from .reddit.more import MoreComments
7 
8 if TYPE_CHECKING:  # pragma: no cover
9     from ... import praw
10 
11 
12 class CommentForest:
13     """A forest of comments starts with multiple top-level comments.
14 
15     Each of these comments can be a tree of replies.
16 
17     """
18 
19     @staticmethod
20     def _gather_more_comments(tree, parent_tree=None):
21         """Return a list of MoreComments objects obtained from tree."""
22         more_comments = []
23         queue = [(None, x) for x in tree]
24         while queue:
25             parent, comment = queue.pop(0)
26             if isinstance(comment, MoreComments):
27                 heappush(more_comments, comment)
28                 if parent:
29                     comment._remove_from = parent.replies._comments
30                 else:
31                     comment._remove_from = parent_tree or tree
32             else:
33                 for item in comment.replies:
34                     queue.append((comment, item))
35         return more_comments
36 
37     def __getitem__(self, index: int):
38         """Return the comment at position ``index`` in the list.
39 
40         This method is to be used like an array access, such as:
41 
42         .. code-block:: python
43 
44             first_comment = submission.comments[0]
45 
46         Alternatively, the presence of this method enables one to iterate over all top
47         level comments, like so:
48 
49         .. code-block:: python
50 
51             for comment in submission.comments:
52                 print(comment.body)
53 
54         """
55         return self._comments[index]
56 
57     def __init__(
58         self,
59         submission: "praw.models.Submission",
60         comments: Optional[List["praw.models.Comment"]] = None,
61     ):
62         """Initialize a CommentForest instance.
63 
64         :param submission: An instance of :class:`~.Subreddit` that is the parent of the
65             comments.
66         :param comments: Initialize the Forest with a list of comments (default: None).
67 
68         """
69         self._comments = comments
70         self._submission = submission
71 
72     def __len__(self) -> int:
73         """Return the number of top-level comments in the forest."""
74         return len(self._comments)
75 
76     def _insert_comment(self, comment):
77         if comment.name in self._submission._comments_by_id:
78             raise DuplicateReplaceException
79         comment.submission = self._submission
80         if isinstance(comment, MoreComments) or comment.is_root:
81             self._comments.append(comment)
82         else:
83             assert comment.parent_id in self._submission._comments_by_id, (
84                 "PRAW Error occurred. Please file a bug report and include the code"
85                 " that caused the error."
86             )
87             parent = self._submission._comments_by_id[comment.parent_id]
88             parent.replies._comments.append(comment)
89 
90     def _update(self, comments):
91         self._comments = comments
92         for comment in comments:
93             comment.submission = self._submission
94 
95     def list(self) -> List[Union["praw.models.Comment", "praw.models.MoreComments"]]:
96         """Return a flattened list of all Comments.
97 
98         This list may contain :class:`.MoreComments` instances if :meth:`.replace_more`
99         was not called first.
100 
101         """
102         comments = []
103         queue = list(self)
104         while queue:
105             comment = queue.pop(0)
106             comments.append(comment)
107             if not isinstance(comment, MoreComments):
108                 queue.extend(comment.replies)
109         return comments
110 
111     def replace_more(
112         self, limit: int = 32, threshold: int = 0
113     ) -> List["praw.models.MoreComments"]:
114         """Update the comment forest by resolving instances of MoreComments.
115 
116         :param limit: The maximum number of :class:`.MoreComments` instances to replace.
117             Each replacement requires 1 API request. Set to ``None`` to have no limit,
118             or to ``0`` to remove all :class:`.MoreComments` instances without
119             additional requests (default: 32).
120         :param threshold: The minimum number of children comments a
121             :class:`.MoreComments` instance must have in order to be replaced.
122             :class:`.MoreComments` instances that represent "continue this thread" links
123             unfortunately appear to have 0 children. (default: 0).
124 
125         :returns: A list of :class:`.MoreComments` instances that were not replaced.
126 
127         For example, to replace up to 32 :class:`.MoreComments` instances of a
128         submission try:
129 
130         .. code-block:: python
131 
132             submission = reddit.submission("3hahrw")
133             submission.comments.replace_more()
134 
135         Alternatively, to replace :class:`.MoreComments` instances within the replies of
136         a single comment try:
137 
138         .. code-block:: python
139 
140             comment = reddit.comment("d8r4im1")
141             comment.refresh()
142             comment.replies.replace_more()
143 
144         .. note::
145 
146             This method can take a long time as each replacement will discover at most
147             20 new :class:`.Comment` or :class:`.MoreComments` instances. As a result,
148             consider looping and handling exceptions until the method returns
149             successfully. For example:
150 
151             .. code-block:: python
152 
153                 while True:
154                     try:
155                         submission.comments.replace_more()
156                         break
157                     except PossibleExceptions:
158                         print("Handling replace_more exception")
159                         sleep(1)
160 
161         .. warning::
162 
163             If this method is called, and the comments are refreshed, calling this
164             method again will result in a :class:`.DuplicateReplaceException`.
165 
166         """
167         remaining = limit
168         more_comments = self._gather_more_comments(self._comments)
169         skipped = []
170 
171         # Fetch largest more_comments until reaching the limit or the threshold
172         while more_comments:
173             item = heappop(more_comments)
174             if remaining is not None and remaining <= 0 or item.count < threshold:
175                 skipped.append(item)
176                 item._remove_from.remove(item)
177                 continue
178 
179             new_comments = item.comments(update=False)
180             if remaining is not None:
181                 remaining -= 1
182 
183             # Add new MoreComment objects to the heap of more_comments
184             for more in self._gather_more_comments(new_comments, self._comments):
185                 more.submission = self._submission
186                 heappush(more_comments, more)
187             # Insert all items into the tree
188             for comment in new_comments:
189                 self._insert_comment(comment)
190 
191             # Remove from forest
192             item._remove_from.remove(item)
193 
194         return more_comments + skipped
195
```
--- 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/praw/models/comment_forest.py b/praw/models/comment_forest.py
--- a/praw/models/comment_forest.py
+++ b/praw/models/comment_forest.py
@@ -124,6 +124,8 @@
 
         :returns: A list of :class:`.MoreComments` instances that were not replaced.
 
+        :raises: ``prawcore.TooManyRequests`` when used concurrently.
+
         For example, to replace up to 32 :class:`.MoreComments` instances of a
         submission try:
 
@@ -144,9 +146,8 @@
         .. note::
 
             This method can take a long time as each replacement will discover at most
-            20 new :class:`.Comment` or :class:`.MoreComments` instances. As a result,
-            consider looping and handling exceptions until the method returns
-            successfully. For example:
+            100 new :class:`.Comment` instances. As a result, consider looping and
+            handling exceptions until the method returns successfully. For example:
 
             .. code-block:: python

{"golden_diff": "diff --git a/praw/models/comment_forest.py b/praw/models/comment_forest.py\n--- a/praw/models/comment_forest.py\n+++ b/praw/models/comment_forest.py\n@@ -124,6 +124,8 @@\n \n         :returns: A list of :class:`.MoreComments` instances that were not replaced.\n \n+        :raises: ``prawcore.TooManyRequests`` when used concurrently.\n+\n         For example, to replace up to 32 :class:`.MoreComments` instances of a\n         submission try:\n \n@@ -144,9 +146,8 @@\n         .. note::\n \n             This method can take a long time as each replacement will discover at most\n-            20 new :class:`.Comment` or :class:`.MoreComments` instances. As a result,\n-            consider looping and handling exceptions until the method returns\n-            successfully. For example:\n+            100 new :class:`.Comment` instances. As a result, consider looping and\n+            handling exceptions until the method returns successfully. For example:\n \n             .. code-block:: python\n", "issue": "Assertion error on 429 HTTP status code\n**Describe the bug**\r\nFrom time to time, I found my codes reported 429 errors.\r\n\r\n**To Reproduce**\r\nSteps to reproduce the behavior:\r\n`submission.comments.replace_more(limit=limit)` with a higher limit for the query, running multiple processes for the same key.\r\n\r\n**Expected behavior**\r\nExpect to handle this error as ratelimit error\r\n\r\n**Code/Logs**\r\n<!-- include your code, without the Reddit() initialization, so as to not leak private credentials. -->\r\n    submission.comments.replace_more(limit=limit)\r\n  File \"/usr/local/lib/python3.7/site-packages/praw/models/comment_forest.py\", line 178, in replace_more\r\n    new_comments = item.comments(update=False)\r\n  File \"/usr/local/lib/python3.7/site-packages/praw/models/reddit/more.py\", line 74, in comments\r\n    self._comments = self._reddit.post(API_PATH[\"morechildren\"], data=data)\r\n  File \"/usr/local/lib/python3.7/site-packages/praw/reddit.py\", line 758, in post\r\n    path=path,\r\n  File \"/usr/local/lib/python3.7/site-packages/praw/reddit.py\", line 672, in _objectify_request\r\n    path=path,\r\n  File \"/usr/local/lib/python3.7/site-packages/praw/reddit.py\", line 855, in request\r\n    json=json,\r\n  File \"/usr/local/lib/python3.7/site-packages/prawcore/sessions.py\", line 331, in request\r\n    url=url,\r\n  File \"/usr/local/lib/python3.7/site-packages/prawcore/sessions.py\", line 265, in _request_with_retries\r\n    ), f\"Unexpected status code: {response.status_code}\"\r\nAssertionError: Unexpected status code: 429\r\n**System Info**\r\n\r\nroot@1be190a235da:/aitrading# uname -a\r\nLinux 1be190a235da 4.19.0-14-cloud-amd64 #1 SMP Debian 4.19.171-2 (2021-01-30) x86_64 GNU/Linux\r\nroot@1be190a235da:/aitrading# python --version\r\nPython 3.7.10\r\nroot@1be190a235da:/aitrading# pip show praw\r\nName: praw\r\nVersion: 7.2.0\r\nSummary: PRAW, an acronym for `Python Reddit API Wrapper`, is a python package that allows for simple access to reddit's API.\r\nHome-page: UNKNOWN\r\nAuthor: Bryce Boe\r\nAuthor-email: bbzbryce@gmail.com\r\nLicense: Simplified BSD License\r\nLocation: /usr/local/lib/python3.7/site-packages\r\nRequires: prawcore, update-checker, websocket-client\r\nRequired-by:\r\nroot@1be190a235da:/aitrading#\r\n\r\n - OS: \r\n - Python: python3.7\r\n - PRAW Version:\r\n\n", "before_files": [{"content": "\"\"\"Provide CommentForest for Submission comments.\"\"\"\nfrom heapq import heappop, heappush\nfrom typing import TYPE_CHECKING, List, Optional, Union\n\nfrom ..exceptions import DuplicateReplaceException\nfrom .reddit.more import MoreComments\n\nif TYPE_CHECKING:  # pragma: no cover\n    from ... import praw\n\n\nclass CommentForest:\n    \"\"\"A forest of comments starts with multiple top-level comments.\n\n    Each of these comments can be a tree of replies.\n\n    \"\"\"\n\n    @staticmethod\n    def _gather_more_comments(tree, parent_tree=None):\n        \"\"\"Return a list of MoreComments objects obtained from tree.\"\"\"\n        more_comments = []\n        queue = [(None, x) for x in tree]\n        while queue:\n            parent, comment = queue.pop(0)\n            if isinstance(comment, MoreComments):\n                heappush(more_comments, comment)\n                if parent:\n                    comment._remove_from = parent.replies._comments\n                else:\n                    comment._remove_from = parent_tree or tree\n            else:\n                for item in comment.replies:\n                    queue.append((comment, item))\n        return more_comments\n\n    def __getitem__(self, index: int):\n        \"\"\"Return the comment at position ``index`` in the list.\n\n        This method is to be used like an array access, such as:\n\n        .. code-block:: python\n\n            first_comment = submission.comments[0]\n\n        Alternatively, the presence of this method enables one to iterate over all top\n        level comments, like so:\n\n        .. code-block:: python\n\n            for comment in submission.comments:\n                print(comment.body)\n\n        \"\"\"\n        return self._comments[index]\n\n    def __init__(\n        self,\n        submission: \"praw.models.Submission\",\n        comments: Optional[List[\"praw.models.Comment\"]] = None,\n    ):\n        \"\"\"Initialize a CommentForest instance.\n\n        :param submission: An instance of :class:`~.Subreddit` that is the parent of the\n            comments.\n        :param comments: Initialize the Forest with a list of comments (default: None).\n\n        \"\"\"\n        self._comments = comments\n        self._submission = submission\n\n    def __len__(self) -> int:\n        \"\"\"Return the number of top-level comments in the forest.\"\"\"\n        return len(self._comments)\n\n    def _insert_comment(self, comment):\n        if comment.name in self._submission._comments_by_id:\n            raise DuplicateReplaceException\n        comment.submission = self._submission\n        if isinstance(comment, MoreComments) or comment.is_root:\n            self._comments.append(comment)\n        else:\n            assert comment.parent_id in self._submission._comments_by_id, (\n                \"PRAW Error occurred. Please file a bug report and include the code\"\n                \" that caused the error.\"\n            )\n            parent = self._submission._comments_by_id[comment.parent_id]\n            parent.replies._comments.append(comment)\n\n    def _update(self, comments):\n        self._comments = comments\n        for comment in comments:\n            comment.submission = self._submission\n\n    def list(self) -> List[Union[\"praw.models.Comment\", \"praw.models.MoreComments\"]]:\n        \"\"\"Return a flattened list of all Comments.\n\n        This list may contain :class:`.MoreComments` instances if :meth:`.replace_more`\n        was not called first.\n\n        \"\"\"\n        comments = []\n        queue = list(self)\n        while queue:\n            comment = queue.pop(0)\n            comments.append(comment)\n            if not isinstance(comment, MoreComments):\n                queue.extend(comment.replies)\n        return comments\n\n    def replace_more(\n        self, limit: int = 32, threshold: int = 0\n    ) -> List[\"praw.models.MoreComments\"]:\n        \"\"\"Update the comment forest by resolving instances of MoreComments.\n\n        :param limit: The maximum number of :class:`.MoreComments` instances to replace.\n            Each replacement requires 1 API request. Set to ``None`` to have no limit,\n            or to ``0`` to remove all :class:`.MoreComments` instances without\n            additional requests (default: 32).\n        :param threshold: The minimum number of children comments a\n            :class:`.MoreComments` instance must have in order to be replaced.\n            :class:`.MoreComments` instances that represent \"continue this thread\" links\n            unfortunately appear to have 0 children. (default: 0).\n\n        :returns: A list of :class:`.MoreComments` instances that were not replaced.\n\n        For example, to replace up to 32 :class:`.MoreComments` instances of a\n        submission try:\n\n        .. code-block:: python\n\n            submission = reddit.submission(\"3hahrw\")\n            submission.comments.replace_more()\n\n        Alternatively, to replace :class:`.MoreComments` instances within the replies of\n        a single comment try:\n\n        .. code-block:: python\n\n            comment = reddit.comment(\"d8r4im1\")\n            comment.refresh()\n            comment.replies.replace_more()\n\n        .. note::\n\n            This method can take a long time as each replacement will discover at most\n            20 new :class:`.Comment` or :class:`.MoreComments` instances. As a result,\n            consider looping and handling exceptions until the method returns\n            successfully. For example:\n\n            .. code-block:: python\n\n                while True:\n                    try:\n                        submission.comments.replace_more()\n                        break\n                    except PossibleExceptions:\n                        print(\"Handling replace_more exception\")\n                        sleep(1)\n\n        .. warning::\n\n            If this method is called, and the comments are refreshed, calling this\n            method again will result in a :class:`.DuplicateReplaceException`.\n\n        \"\"\"\n        remaining = limit\n        more_comments = self._gather_more_comments(self._comments)\n        skipped = []\n\n        # Fetch largest more_comments until reaching the limit or the threshold\n        while more_comments:\n            item = heappop(more_comments)\n            if remaining is not None and remaining <= 0 or item.count < threshold:\n                skipped.append(item)\n                item._remove_from.remove(item)\n                continue\n\n            new_comments = item.comments(update=False)\n            if remaining is not None:\n                remaining -= 1\n\n            # Add new MoreComment objects to the heap of more_comments\n            for more in self._gather_more_comments(new_comments, self._comments):\n                more.submission = self._submission\n                heappush(more_comments, more)\n            # Insert all items into the tree\n            for comment in new_comments:\n                self._insert_comment(comment)\n\n            # Remove from forest\n            item._remove_from.remove(item)\n\n        return more_comments + skipped\n", "path": "praw/models/comment_forest.py"}], "after_files": [{"content": "\"\"\"Provide CommentForest for Submission comments.\"\"\"\nfrom heapq import heappop, heappush\nfrom typing import TYPE_CHECKING, List, Optional, Union\n\nfrom ..exceptions import DuplicateReplaceException\nfrom .reddit.more import MoreComments\n\nif TYPE_CHECKING:  # pragma: no cover\n    from ... import praw\n\n\nclass CommentForest:\n    \"\"\"A forest of comments starts with multiple top-level comments.\n\n    Each of these comments can be a tree of replies.\n\n    \"\"\"\n\n    @staticmethod\n    def _gather_more_comments(tree, parent_tree=None):\n        \"\"\"Return a list of MoreComments objects obtained from tree.\"\"\"\n        more_comments = []\n        queue = [(None, x) for x in tree]\n        while queue:\n            parent, comment = queue.pop(0)\n            if isinstance(comment, MoreComments):\n                heappush(more_comments, comment)\n                if parent:\n                    comment._remove_from = parent.replies._comments\n                else:\n                    comment._remove_from = parent_tree or tree\n            else:\n                for item in comment.replies:\n                    queue.append((comment, item))\n        return more_comments\n\n    def __getitem__(self, index: int):\n        \"\"\"Return the comment at position ``index`` in the list.\n\n        This method is to be used like an array access, such as:\n\n        .. code-block:: python\n\n            first_comment = submission.comments[0]\n\n        Alternatively, the presence of this method enables one to iterate over all top\n        level comments, like so:\n\n        .. code-block:: python\n\n            for comment in submission.comments:\n                print(comment.body)\n\n        \"\"\"\n        return self._comments[index]\n\n    def __init__(\n        self,\n        submission: \"praw.models.Submission\",\n        comments: Optional[List[\"praw.models.Comment\"]] = None,\n    ):\n        \"\"\"Initialize a CommentForest instance.\n\n        :param submission: An instance of :class:`~.Subreddit` that is the parent of the\n            comments.\n        :param comments: Initialize the Forest with a list of comments (default: None).\n\n        \"\"\"\n        self._comments = comments\n        self._submission = submission\n\n    def __len__(self) -> int:\n        \"\"\"Return the number of top-level comments in the forest.\"\"\"\n        return len(self._comments)\n\n    def _insert_comment(self, comment):\n        if comment.name in self._submission._comments_by_id:\n            raise DuplicateReplaceException\n        comment.submission = self._submission\n        if isinstance(comment, MoreComments) or comment.is_root:\n            self._comments.append(comment)\n        else:\n            assert comment.parent_id in self._submission._comments_by_id, (\n                \"PRAW Error occurred. Please file a bug report and include the code\"\n                \" that caused the error.\"\n            )\n            parent = self._submission._comments_by_id[comment.parent_id]\n            parent.replies._comments.append(comment)\n\n    def _update(self, comments):\n        self._comments = comments\n        for comment in comments:\n            comment.submission = self._submission\n\n    def list(self) -> List[Union[\"praw.models.Comment\", \"praw.models.MoreComments\"]]:\n        \"\"\"Return a flattened list of all Comments.\n\n        This list may contain :class:`.MoreComments` instances if :meth:`.replace_more`\n        was not called first.\n\n        \"\"\"\n        comments = []\n        queue = list(self)\n        while queue:\n            comment = queue.pop(0)\n            comments.append(comment)\n            if not isinstance(comment, MoreComments):\n                queue.extend(comment.replies)\n        return comments\n\n    def replace_more(\n        self, limit: int = 32, threshold: int = 0\n    ) -> List[\"praw.models.MoreComments\"]:\n        \"\"\"Update the comment forest by resolving instances of MoreComments.\n\n        :param limit: The maximum number of :class:`.MoreComments` instances to replace.\n            Each replacement requires 1 API request. Set to ``None`` to have no limit,\n            or to ``0`` to remove all :class:`.MoreComments` instances without\n            additional requests (default: 32).\n        :param threshold: The minimum number of children comments a\n            :class:`.MoreComments` instance must have in order to be replaced.\n            :class:`.MoreComments` instances that represent \"continue this thread\" links\n            unfortunately appear to have 0 children. (default: 0).\n\n        :returns: A list of :class:`.MoreComments` instances that were not replaced.\n\n        :raises: ``prawcore.TooManyRequests`` when used concurrently.\n\n        For example, to replace up to 32 :class:`.MoreComments` instances of a\n        submission try:\n\n        .. code-block:: python\n\n            submission = reddit.submission(\"3hahrw\")\n            submission.comments.replace_more()\n\n        Alternatively, to replace :class:`.MoreComments` instances within the replies of\n        a single comment try:\n\n        .. code-block:: python\n\n            comment = reddit.comment(\"d8r4im1\")\n            comment.refresh()\n            comment.replies.replace_more()\n\n        .. note::\n\n            This method can take a long time as each replacement will discover at most\n            100 new :class:`.Comment` instances. As a result, consider looping and\n            handling exceptions until the method returns successfully. For example:\n\n            .. code-block:: python\n\n                while True:\n                    try:\n                        submission.comments.replace_more()\n                        break\n                    except PossibleExceptions:\n                        print(\"Handling replace_more exception\")\n                        sleep(1)\n\n        .. warning::\n\n            If this method is called, and the comments are refreshed, calling this\n            method again will result in a :class:`.DuplicateReplaceException`.\n\n        \"\"\"\n        remaining = limit\n        more_comments = self._gather_more_comments(self._comments)\n        skipped = []\n\n        # Fetch largest more_comments until reaching the limit or the threshold\n        while more_comments:\n            item = heappop(more_comments)\n            if remaining is not None and remaining <= 0 or item.count < threshold:\n                skipped.append(item)\n                item._remove_from.remove(item)\n                continue\n\n            new_comments = item.comments(update=False)\n            if remaining is not None:\n                remaining -= 1\n\n            # Add new MoreComment objects to the heap of more_comments\n            for more in self._gather_more_comments(new_comments, self._comments):\n                more.submission = self._submission\n                heappush(more_comments, more)\n            # Insert all items into the tree\n            for comment in new_comments:\n                self._insert_comment(comment)\n\n            # Remove from forest\n            item._remove_from.remove(item)\n\n        return more_comments + skipped\n", "path": "praw/models/comment_forest.py"}]}