import operator


def _sortPullRequests(pull_requests):
    """
    Helper function from _formatPullRequests(). Sort a list of pull requests by pull request number
    and then by comment creation date.

    GIVEN:
      pull_requests (list) -- nested list of pull_requests and their comments

    RETURN:
      new_pull_requests (list) -- the given 'pull_requests' list, but sorted by pull request number
                                  and comment creation date
    """
    new_pull_requests = sorted(pull_requests, key=operator.itemgetter(3, 9))
    return new_pull_requests