def iscomplex(polynomial):
if isinstance(polynomial, (int, float)):<EOL><INDENT>return False<EOL><DEDENT>if isinstance(polynomial, complex):<EOL><INDENT>return True<EOL><DEDENT>polynomial = polynomial.expand()<EOL>for monomial in polynomial.as_coefficients_dict():<EOL><INDENT>for variable in monomial.as_coeff_mul()[<NUM_LIT:1>]:<EOL><INDENT>if isinstance(variable, complex) or variable == I:<EOL><INDENT>return True<EOL><DEDENT><DEDENT><DEDENT>return False<EOL>
Returns whether the polynomial has complex coefficients

    :param polynomial: Polynomial of noncommutive variables.
    :type polynomial: :class:`sympy.core.expr.Expr`.

    :returns: bool -- whether there is a complex coefficient.