code: def fetchThreads(self, thread_location, before=None, after=None, limit=None):
          threads = []
          last_thread_timestamp = None
          while True:
              if limit and len(threads) >= limit:
                  break
              candidates = self.fetchThreadList(
                  before=last_thread_timestamp, thread_location=thread_location
              )
              if len(candidates) > 1:
                  threads += candidates[1:]
              else:
                  break
              last_thread_timestamp = threads[-1].last_message_timestamp
              if (before is not None and int(last_thread_timestamp) > before) or (
                  after is not None and int(last_thread_timestamp) < after
              ):
                  break
          if before is not None or after is not None:
              for t in threads:
                  last_message_timestamp = int(t.last_message_timestamp)
                  if (before is not None and last_message_timestamp > before) or (
                      after is not None and last_message_timestamp < after
                  ):
                      threads.remove(t)
          if limit and len(threads) > limit:
              return threads[:limit]
          return threads