def missing_machine_learner(xdata, mdata, all_a, none_a, ml_model,
    print_results=True):
    """Function to fit machine learning predictions. Used by TMLE to generate predicted probabilities of missing
     outcome data, Pr(M=1|A,L)
    """
    try:
        fm = ml_model.fit(X=xdata, y=mdata)
    except TypeError:
        raise TypeError(
            "Currently custom_model must have the 'fit' function with arguments 'X', 'y'. This covers both sklearn and supylearner. If there is a predictive model you would like to use, please open an issue at https://github.com/pzivich/zepid and I can work on adding support"
            )
    if print_results and hasattr(fm, 'summarize'):
        fm.summarize()
    if hasattr(fm, 'predict_proba'):
        ma1 = fm.predict_proba(all_a)
        ma0 = fm.predict_proba(none_a)
        if ma1.ndim == 1 and ma0.ndim == 1:
            return ma1, ma0
        else:
            return ma1[:, (1)], ma0[:, (1)]
    elif hasattr(fm, 'predict'):
        ma1 = fm.predict(all_a)
        ma0 = fm.predict(none_a)
        return ma1, ma0
    else:
        raise ValueError(
            "Currently custom_model must have 'predict' or 'predict_proba' attribute"
            )
