(f, x)
Try to rewrite f as a product of two G functions of arguments a*x**b.
    Return fac, po, g1, g2 such that f = fac*po*g1*g2, where fac is
    independent of x and po is x**s.
    Here g1 and g2 are results of _rewrite_single.
    Returns None on failure.
Try to rewrite f as a product of two G functions of arguments a*x**b.
    Return fac, po, g1, g2 such that f = fac*po*g1*g2, where fac is
    independent of x and po is x**s.
    Here g1 and g2 are results of _rewrite_single.
    Returns None on failure.
Try to rewrite f as a product of two G functions of arguments a * x ** b . Return fac po g1 g2 such that f = fac * po * g1 * g2 where fac is independent of x and po is x ** s . Here g1 and g2 are results of _rewrite_single . Returns None on failure .
def _rewrite2(f, x):
    """
    Try to rewrite f as a product of two G functions of arguments a*x**b.
    Return fac, po, g1, g2 such that f = fac*po*g1*g2, where fac is
    independent of x and po is x**s.
    Here g1 and g2 are results of _rewrite_single.
    Returns None on failure.
    """
    fac, po, g = _split_mul(f, x)
    if any(_rewrite_single(expr, x, False) is None for expr in _mul_args(g)):
        return None
    l = _mul_as_two_parts(g)
    if not l:
        return None
    l = list(ordered(l, [
        lambda p: max(len(_exponents(p[0], x)), len(_exponents(p[1], x))),
        lambda p: max(len(_functions(p[0], x)), len(_functions(p[1], x))),
        lambda p: max(len(_find_splitting_points(p[0], x)),
                      len(_find_splitting_points(p[1], x)))]))

    for recursive in [False, True]:
        for fac1, fac2 in l:
            g1 = _rewrite_single(fac1, x, recursive)
            g2 = _rewrite_single(fac2, x, recursive)
            if g1 and g2:
                cond = And(g1[1], g2[1])
                if cond != False:
                    return fac, po, g1[0], g2[0], cond
def _rewrite2 ( f , x ) : fac , po , g = _split_mul ( f , x ) if any ( _rewrite_single ( expr , x , False ) is None for expr in _mul_args ( g ) ) : return None l = _mul_as_two_parts ( g ) if not l : return None l = list ( ordered ( l , [ lambda p : max ( len ( _exponents ( p [ 0 ] , x ) ) , len ( _exponents ( p [ 1 ] , x ) ) ) , lambda p : max ( len ( _functions ( p [ 0 ] , x ) ) , len ( _functions ( p [ 1 ] , x ) ) ) , lambda p : max ( len ( _find_splitting_points ( p [ 0 ] , x ) ) , len ( _find_splitting_points ( p [ 1 ] , x ) ) ) ] ) ) for recursive in [ False , True ] : for fac1 , fac2 in l : g1 = _rewrite_single ( fac1 , x , recursive ) g2 = _rewrite_single ( fac2 , x , recursive ) if g1 and g2 : cond = And ( g1 [ 1 ] , g2 [ 1 ] ) if cond != False : return fac , po , g1 [ 0 ] , g2 [ 0 ] , cond