def create_infertility_feature(diagnosis):
    """
    Creates the one-hot encoded infertility diagnosis feature from a given
    diagnosis.

    Parameters:
    -----------
    diagnosis : str, 
        The infertility diagnosis, must be one of Ovulatory disorder, 
        Male factor, Endometriosis or Unexplained.

    Returns:
    -------
    infertility : list,
        The one-hot encoded infertility feature.
    """
    # column index in feature matrix of feature
    idx_dict = {'Tubal disease':0, 'Ovulatory disorder':1, 'Male factor':2,
                          'Endometriosis':3, 'Unexplained':4}

    # create feature vector
    idx = idx_dict[diagnosis]
    infertility = [0,0, 0, 0, 0]
    infertility[idx] = 1
    return infertility