def unify_sex(sex):
    """Maps the sex of a patient into one of the following values: "M", "F" or
    ``None``.

    Parameters
    ----------
    sex : str
        Sex of the patient.

    Returns
    -------
    sex : str
        Transformed sex of the patient.
    """
    transform_dict = {
        "MALE": "M",
        "M": "M",
        "FEMALE": "F",
        "F": "F",
    }
    return transform_dict.get(sex)