def _guess_endog_name(self, model, typ):
        if hasattr(model, 'formula'):
            return model.formula.split("~")[0].strip()
        else:
            raise ValueError('cannot infer %s name without formula' % typ)
dataset/ETHPy150Open statsmodels/statsmodels/statsmodels/stats/mediation.py/Mediation._guess_endog_name/original