'solve for any one of the parameters of a t-test
for t-test the keywords are:
effect_size, nobs, alpha, power
exactly one needs to be ``None``, all others need numeric values
*attaches*
cache_fit_res : list
Cache of the result of the root finding procedure for the latest
call to ``solve_power``, mainly for debugging purposes.
The first element is the success indicator, one if successful.
The remaining elements contain the return information of the up to
three solvers that have been tried.'

def solve_power(self, **kwds):

    key = [k for (k, v) in iteritems(kwds) if (v is None)]
    if (len(key) != 1):
        raise ValueError('need    exactly    one    keyword    that    is    None')
    key = key[0]
    if (key == 'power'):
        del kwds['power']
        return self.power(**kwds)
    self._counter = 0
    def func(x):
        kwds[key] = x
        fval = self._power_identity(**kwds)
        self._counter += 1
        if (self._counter > 500):
            raise RuntimeError('possible    endless    loop    (500    NaNs)')
        if np.isnan(fval):
            return np.inf
        else:
            return fval
    try:
        start_value = self.start_ttp[key]
    except KeyError:
        start_value = 0.9
        print('Warning:    using    default    start_value    for    {0}'.format(key))
    fit_kwds = self.start_bqexp[key]
    fit_res = []
    try:
        (val, res) = brentq_expanding(func, full_output=True, **fit_kwds)
        failed = False
        fit_res.append(res)
    except ValueError:
        failed = True
        fit_res.append(None)
    success = None
    if ((not failed) and res.converged):
        success = 1
    else:
        (val, infodict, ier, msg) = optimize.fsolve(func, start_value, full_output=True)
        fval = infodict['fvec']
        fit_res.append(infodict)
        if ((ier == 1) and (np.abs(fval) < 0.0001)):
            success = 1
        elif (key in ['alpha', 'power', 'effect_size']):
            (val, r) = optimize.brentq(func, 1e-08, (1 - 1e-08), full_output=True)
            success = (1 if r.converged else 0)
            fit_res.append(r)
        else:
            success = 0
    if (not (success == 1)):
        import warnings
        from statsmodels.tools.sm_exceptions import ConvergenceWarning, convergence_doc
        warnings.warn(convergence_doc, ConvergenceWarning)
    fit_res.insert(0, success)
    self.cache_fit_res = fit_res
    return val
