(arg, cycles=1)
When arg is a Number times pi (e.g. 3*pi/2) then return the Number
    normalized to be in the range [0, 2], else None.

    When an even multiple of pi is encountered, if it is multiplying
    something with known parity then the multiple is returned as 0 otherwise
    as 2.

    Examples
    ========

    >>> from sympy.functions.elementary.trigonometric import _pi_coeff as coeff
    >>> from sympy import pi
    >>> from sympy.abc import x, y
    >>> coeff(3*x*pi)
    3*x
    >>> coeff(11*pi/7)
    11/7
    >>> coeff(-11*pi/7)
    3/7
    >>> coeff(4*pi)
    0
    >>> coeff(5*pi)
    1
    >>> coeff(5.0*pi)
    1
    >>> coeff(5.5*pi)
    3/2
    >>> coeff(2 + pi)
When arg is a Number times pi (e.g. 3*pi/2) then return the Number
    normalized to be in the range [0, 2], else None.
When arg is a Number times pi ( e . g . 3 * pi / 2 ) then return the Number normalized to be in the range [ 0 2 ] else None .
def _pi_coeff(arg, cycles=1):
    """
    When arg is a Number times pi (e.g. 3*pi/2) then return the Number
    normalized to be in the range [0, 2], else None.

    When an even multiple of pi is encountered, if it is multiplying
    something with known parity then the multiple is returned as 0 otherwise
    as 2.

    Examples
    ========

    >>> from sympy.functions.elementary.trigonometric import _pi_coeff as coeff
    >>> from sympy import pi
    >>> from sympy.abc import x, y
    >>> coeff(3*x*pi)
    3*x
    >>> coeff(11*pi/7)
    11/7
    >>> coeff(-11*pi/7)
    3/7
    >>> coeff(4*pi)
    0
    >>> coeff(5*pi)
    1
    >>> coeff(5.0*pi)
    1
    >>> coeff(5.5*pi)
    3/2
    >>> coeff(2 + pi)

    """
    arg = sympify(arg)
    if arg is S.Pi:
        return S.One
    elif not arg:
        return S.Zero
    elif arg.is_Mul:
        cx = arg.coeff(S.Pi)
        if cx:
            c, x = cx.as_coeff_Mul()  # pi is not included as coeff
            if c.is_Float:
                # recast exact binary fractions to Rationals
                f = abs(c) % 1
                if f != 0:
                    p = -int(round(log(f, 2).evalf()))
                    m = 2**p
                    cm = c*m
                    i = int(cm)
                    if i == cm:
                        c = C.Rational(i, m)
                        cx = c*x
                else:
                    c = C.Rational(int(c))
                    cx = c*x
            if x.is_integer:
                c2 = c % 2
                if c2 == 1:
                    return x
                elif not c2:
                    if x.is_even is not None:  # known parity
                        return S.Zero
                    return 2*x
                else:
                    return c2*x
            return cx
def _pi_coeff ( arg , cycles = 1 ) : arg = sympify ( arg ) if arg is S . Pi : return S . One elif not arg : return S . Zero elif arg . is_Mul : cx = arg . coeff ( S . Pi ) if cx : c , x = cx . as_coeff_Mul ( ) # pi is not included as coeff if c . is_Float : # recast exact binary fractions to Rationals f = abs ( c ) % 1 if f != 0 : p = - int ( round ( log ( f , 2 ) . evalf ( ) ) ) m = 2 ** p cm = c * m i = int ( cm ) if i == cm : c = C . Rational ( i , m ) cx = c * x else : c = C . Rational ( int ( c ) ) cx = c * x if x . is_integer : c2 = c % 2 if c2 == 1 : return x elif not c2 : if x . is_even is not None : # known parity return S . Zero return 2 * x else : return c2 * x return cx