def does_regex_have_group(regex_matches, group_name):
    """Return a boolean depending on whether a regex group is matched."""
    try:
        return regex_matches.group(group_name) is not None
    except IndexError:
        return False
