#NEWLINE# def kernel( zr , zi , cr , ci , lim , cutoff ) : #NEWLINE# #INDENT# ' Computes the number of iterations `n` such that \n        |z_n| > `lim`, where `z_n = z_{n-1}**2 + c`.\n    ' #NEWLINE# count = 0 #NEWLINE# while ( ( ( ( zr * zr ) + ( zi * zi ) ) < ( lim * lim ) ) and ( count < cutoff ) ) : #NEWLINE# #INDENT# ( zr , zi ) = ( ( ( ( zr * zr ) - ( zi * zi ) ) + zr ) , ( ( ( 2 * zr ) * zi ) + ci ) ) #NEWLINE# count += 1 #NEWLINE# #UNINDENT# return count