import re


def _get_summary(gh_issue):
    """
    Return the JIRA summary corresponding to a given GitHub issue

    Format is: GH/PR #<gh issue number>: <github title without any JIRA slug>
    """
    is_pr = "pull_request" in gh_issue
    result = "%s #%d: %s" % ("PR" if is_pr else "GH", gh_issue["number"], gh_issue["title"])

    # don't mirror any existing JIRA slug-like pattern from GH title to JIRA summary
    # (note we don't look for a particular pattern as the JIRA issue may have moved)
    result = re.sub(r" \([\w]+-[\d]+\)", "", result)

    return result