(rv)
return bottom_up(rv, f)
Convert f(x)**-i to g(x)**i where either ``i`` is an integer
    or the base is positive and f, g are: tan, cot; sin, csc; or cos, sec.

    Examples
    ========

    >>> from sympy.simplify.fu import TR111
    >>> from sympy.abc import x
    >>> from sympy import tan
    >>> TR111(1 - 1/tan(x)**2)
    -cot(x)**2 + 1
Convert f(x)**-i to g(x)**i where either ``i`` is an integer
    or the base is positive and f, g are: tan, cot; sin, csc; or cos, sec.
Convert f ( x ) ** - i to g ( x ) ** i where either i is an integer or the base is positive and f g are : tan cot ; sin csc ; or cos sec .
def TR111(rv):
    """Convert f(x)**-i to g(x)**i where either ``i`` is an integer
    or the base is positive and f, g are: tan, cot; sin, csc; or cos, sec.

    Examples
    ========

    >>> from sympy.simplify.fu import TR111
    >>> from sympy.abc import x
    >>> from sympy import tan
    >>> TR111(1 - 1/tan(x)**2)
    -cot(x)**2 + 1

    """

    def f(rv):
        if not (
            isinstance(rv, Pow) and
            (rv.base.is_positive or rv.exp.is_integer and rv.exp.is_negative)):
            return rv

        if rv.base.func is tan:
            return cot(rv.base.args[0])**-rv.exp
        elif rv.base.func is sin:
            return csc(rv.base.args[0])**-rv.exp
        elif rv.base.func is cos:
            return sec(rv.base.args[0])**-rv.exp
        return rv

    return bottom_up(rv, f)
def TR111 ( rv ) : def f ( rv ) : if not ( isinstance ( rv , Pow ) and ( rv . base . is_positive or rv . exp . is_integer and rv . exp . is_negative ) ) : return rv if rv . base . func is tan : return cot ( rv . base . args [ 0 ] ) ** - rv . exp elif rv . base . func is sin : return csc ( rv . base . args [ 0 ] ) ** - rv . exp elif rv . base . func is cos : return sec ( rv . base . args [ 0 ] ) ** - rv . exp return rv return bottom_up ( rv , f )