def iterate_mandelbrot(iterate_max, c, z = 0):
    """Calculate the mandelbrot sequence for the point c with start value z"""
    for n in range(iterate_max + 1):
        z = z * z + c
        if abs(z) > 2:
            return n
    return None