def transform_gender(value):
    """
    Transform any gender value into a normalized value.
    """
    if value.lower() in ("male", "m"):
        return "male"
    elif value.lower() in ("female", "f"):
        return "female"
    elif value.lower() in ("other", "o"):
        return "other"
    elif value.lower() in ("not specified", "ns", "na", "n/a"):
        return "not specified"
    elif value.strip():
        return "not specified"
    else:
        return None