def should_backport(labels=None, milestone=None):
    """return set of PRs marked for backport"""
    if labels is None and milestone is None:
        raise ValueError("Specify one of labels or milestone.")
    elif labels is not None and milestone is not None:
        raise ValueError("Specify only one of labels or milestone.")
    if labels is not None:
        issues = get_issues_list("statsmodels/statsmodels",
                labels=labels,
                state='closed',
                auth=True,
        )
    else:
        milestone_id = get_milestone_id("statsmodels/statsmodels", milestone,
                auth=True)
        issues = get_issues_list("statsmodels/statsmodels",
                milestone=milestone_id,
                state='closed',
                auth=True,
        )

    should_backport = []
    merged_dates = []
    for issue in issues:
        if not is_pull_request(issue):
            continue
        pr = get_pull_request("statsmodels/statsmodels", issue['number'],
                auth=True)
        if not pr['merged']:
            print("Marked PR closed without merge: %i" % pr['number'])
            continue
        if pr['number'] not in should_backport:
            merged_dates.append(pr['merged_at'])
            should_backport.append(pr['number'])
    return Series(merged_dates, index=should_backport)
dataset/ETHPy150Open statsmodels/statsmodels/tools/backport_pr.py/should_backport/original