def _get_jira_issue_type(jira, gh_issue):
    """
    Try to map a GitHub label to a JIRA issue type. Matches will happen when the label
    matches the issue type (case insensitive) or when the label has the form "Type: <issuetype>"

    NOTE: This is only suitable for setting on new issues. Changing issue type is unsafe.
    See https://jira.atlassian.com/browse/JRACLOUD-68207
    """
    gh_labels = [l["name"] for l in gh_issue["labels"]]

    issue_types = jira.issue_types()

    for gh_label in gh_labels:
        for issue_type in issue_types:
            type_name = issue_type.name.lower()
            if gh_label.lower() in [type_name, "type: %s" % (type_name,)]:
                # a match!
                print("Mapping GitHub label '%s' to JIRA issue type '%s'" % (gh_label, issue_type.name))
                return {"id": issue_type.id}  # JIRA API needs JSON here

    return None