def gender_similarity_scorer(gender_1: str, gender_2: str):
    """Compares two gender strings, returns 0 if they match, returns penalty of -1 otherwise.

    Conservative assumption: if gender is nil or empty string, consider it a match against the comparator.
    """
    if gender_1 == gender_2:
        return 0
    elif gender_1 is None or gender_2 is None:
        return 0
    elif gender_1 == "" or gender_2 == "":
        return 0
    else:
        return -1