docs: def check_auto_merge_labeler(repo: GithubRepository, pull_id: int
                               ) -> Optional[CannotAutomergeError]:
      """
      References:
          https://developer.github.com/v3/issues/events/#list-events-for-an-issue
      """
      url = ("https://api.github.com/repos/{}/{}/issues/{}/events"
             "?access_token={}".format(repo.organization,
                                       repo.name,
                                       pull_id,
                                       repo.access_token))
  
      response = requests.get(url)
  
      if response.status_code != 200:
          raise RuntimeError(
              'Event check failed. Code: {}. Content: {}.'.format(
                  response.status_code, response.content))
  
      payload = json.JSONDecoder().decode(response.content.decode())
      relevant = [event
                  for event in payload
                  if event['event'] == 'labeled' and
                  event['label']['name'] in AUTO_MERGE_LABELS]
      if not relevant:
          return CannotAutomergeError('"automerge" label was never added.')
  
      return check_collaborator_has_write(repo, relevant[-1]['actor']['login'])