code: def calc_fractal_serial(q, maxiter):
      # calculate z using pure python on a numpy array
      # note that, unlike the other two implementations,
      # the number of iterations per point is NOT constant
      z = np.zeros(q.shape, complex)
      output = np.resize(
          np.array(
              0,
          ),
          q.shape,
      )
      for i in range(len(q)):
          for iter in range(maxiter):
              z[i] = z[i] * z[i] + q[i]
              if abs(z[i]) > 2.0:
                  output[i] = iter
                  break
      return output
  
file_path: pyopencl/examples/demo_mandelbrot.py
imports: import time
  import numpy
  import pyopencl
  from PIL import Image
label_desc: Use image node_id 2 for calling a global function with example usage: calc_fractal_serial(q, maxiter) and returns: output