return a summary for this bug/issue. If it can't be found,
    return None.

def get_summary(config, bugnumber):
    """return a summary for this bug/issue. If it can't be found,
    return None."""

    bugzilla_url_regex = re.compile(
        re.escape("https://bugzilla.mozilla.org/show_bug.cgi?id=") + r"(\d+)$"
    )

    # The user could have pasted in a bugzilla ID or a bugzilla URL
    if bugzilla_url_regex.search(bugnumber.split("#")[0]):
        # that's easy then!
        bugzilla_id, = bugzilla_url_regex.search(bugnumber.split("#")[0]).groups()
        bugzilla_id = int(bugzilla_id)
        summary, url = bugzilla.get_summary(config, bugzilla_id)
        return summary, bugzilla_id, url

    # The user could have pasted in a GitHub issue URL
    github_url_regex = re.compile(r"https://github.com/([^/]+)/([^/]+)/issues/(\d+)")
    if github_url_regex.search(bugnumber.split("#")[0]):
        # that's also easy
        org, repo, id_, = github_url_regex.search(bugnumber.split("#")[0]).groups()
        id_ = int(id_)
        title, url = github.get_title(config, org, repo, id_)
        return title, id_, url

    # If it's a number it can be either a github issue or a bugzilla bug
    if bugnumber.isdigit():
        # try both and see if one of them turns up something interesting

        repo = config.repo
        state = read(config.configfile)
        fork_name = state.get("FORK_NAME", getpass.getuser())
        if config.verbose:
            info_out("Using fork name: {}".format(fork_name))
        candidates = []
        # Looping over the remotes, let's figure out which one
        # is the one that has issues. Let's try every one that isn't
        # your fork remote.
        for origin in repo.remotes:
            if origin.name == fork_name:
                continue
            url = origin.url
            org, repo = parse_remote_url(origin.url)
            github_title, github_url = github.get_title(
                config, org, repo, int(bugnumber)
            )
            if github_title:
                candidates.append((github_title, int(bugnumber), github_url))

        bugzilla_summary, bugzilla_url = bugzilla.get_summary(config, bugnumber)
        if bugzilla_summary:
            candidates.append((bugzilla_summary, int(bugnumber), bugzilla_url))

        if len(candidates) > 1:
            info_out(
                "Input is ambiguous. Multiple possibilities found. "
                "Please re-run with the full URL:"
            )
            for title, _, url in candidates:
                info_out("\t{}".format(url))
                info_out("\t{}\n".format(title))
            error_out("Awaiting your choice")
        elif len(candidates) == 1:
            return candidates[0]
        else:
            error_out("ID could not be found on GitHub or Bugzilla")
        raise Exception(bugnumber)

    return bugnumber, None, None