code: def filter_pull_requests(
      pull_requests,
      start_pull_request_id=None,
      end_pull_request_id=1,
      end_is_off_by_one=False,
  ):
      "Returns all pull requests that have the same pull request id as the given limits or are inbetween."
      collected_pull_requests = []
      page_counter = 0
      if start_pull_request_id is None:
          collect_flag = True
      else:
          collect_flag = False
      stop_flag = False
      while True:
          try:
              # pull requests will are sorted by newest
              pull_request_page = pull_requests.get_page(page_counter)
              # stop when a empty page appears as only empty pages follow onwards
              if len(pull_request_page) == 0:
                  break
              for pull_request in pull_requests:
                  if start_pull_request_id == pull_request.number:
                      collect_flag = True
                  if collect_flag:
                      collected_pull_requests.append(pull_request)
                  if end_pull_request_id == pull_request.number:
                      stop_flag = True
                      # if the end is off by one due to using the end of the version before the last element of the
                      # collected pull requests needs to be removed0
                      if end_is_off_by_one:
                          collected_pull_requests = (
                              collected_pull_requests[:-1]
                          )
                      break
              page_counter += 1
              if stop_flag:
                  break
          except:
              break
      return collected_pull_requests
  
file_path: icevision/update_changelog.py
imports: import argparse
  from io import StringIO
  import json
  from github import Github
label_desc: Use image node_id 2 for calling a global function with example usage: filter_pull_requests(pull_requests, start_pull_request_id, end_pull_request_id, end_is_off_by_one) and returns: collected_pull_requests