code: def get_external_pr_data(
      start_date: datetime.date,
      end_date: datetime.date,
      period_length: int = 1,
  ) -> List[Dict[str, Any]]:
      pr_info = []
      period_begin_date = start_date
  
      pr_count = 0
      users: Set[str] = set()
      while period_begin_date < end_date:
          period_end_date = period_begin_date + datetime.timedelta(
              days=period_length - 1
          )
          page = 1
          responses: List[Dict[str, Any]] = []
          while len(responses) > 0 or page == 1:
              response = cast(
                  Dict[str, Any],
                  fetch_json(
                      "https://api.github.com/search/issues",
                      params={
                          "q": f'repo:pytorch/pytorch is:pr is:closed \
                              label:"open source" label:Merged -label:Reverted closed:{period_begin_date}..{period_end_date}',
                          "per_page": "100",
                          "page": str(page),
                      },
                  ),
              )
              items = response["items"]
              for item in items:
                  u = item["user"]["login"]
                  if u not in FILTER_OUT_USERS:
                      pr_count += 1
                      users.add(u)
              page += 1
  
          pr_info.append(
              {
                  "date": str(period_begin_date),
                  "pr_count": pr_count,
                  "user_count": len(users),
                  "users": list(users),
              }
          )
          period_begin_date = period_end_date + datetime.timedelta(
              days=1
          )
      return pr_info
  
file_path: pytorch/tools/stats/upload_external_contrib_stats.py
imports: import argparse
  import datetime
  import json
  import os
  import time
  import urllib.parse
  from typing import Any, Callable, cast, Dict, List, Optional, Set
  from urllib.error import HTTPError
  from urllib.request import Request, urlopen
  from tools.stats.upload_stats_lib import upload_to_s3
label_desc: Use image node_id 3 for calling a global function with example usage: get_external_pr_data(start_date, end_date, period_length) and returns: pr_info