import numbers


def contains_complex(A):
    """Return True if the array contains any (non-real) complex numbers."""
    return any(isinstance(x, numbers.Complex) and not isinstance(x, numbers.Real)
            for x in A.flat)