def _safe_arma_fit(y, order, model_kw, trend, fit_kw, start_params=None):
    try:
        return ARMA(y, order=order, **model_kw).fit(disp=0, trend=trend, start_params=start_params, **fit_kw)
    except LinAlgError:
        return
    except ValueError as error:
        if (start_params is not None):
            return
        elif (('initial' not in error.args[0]) or ('initial' in str(error))):
            start_params = ([0.1] * sum(order))
            if (trend == 'c'):
                start_params = ([0.1] + start_params)
            return _safe_arma_fit(y, order, model_kw, trend, fit_kw, start_params)
        else:
            return
    except:
        return
def _safe_arma_fit(y, order, model_kw, trend, fit_kw, start_params=None):
    try:
        return ARMA(y, order=order, **model_kw).fit(disp=0, trend=trend, start_params=start_params, **fit_kw)
    except LinAlgError:
        return
    except ValueError as error:
        if (start_params is not None):
            return
        elif (('initial' not in error.args[0]) or ('initial' in str(error))):
            start_params = ([0.1] * sum(order))
            if (trend == 'c'):
                start_params = ([0.1] + start_params)
            return _safe_arma_fit(y, order, model_kw, trend, fit_kw, start_params)
        else:
            return
    except:
        return