def _kernel(kernel_spec):
 if isinstance(kernel_spec, int):
  return [kernel_spec, kernel_spec]
 elif (len(kernel_spec) == 1):
  return [kernel_spec[0], kernel_spec[0]]
 else:
  assert (len(kernel_spec) == 2)
  return kernel_spec

def _kernel ( kernel_spec ) : if isinstance ( kernel_spec , int ) : return [ kernel_spec , kernel_spec ] elif ( len ( kernel_spec ) == 1 ) : return [ kernel_spec [ 0 ] , kernel_spec [ 0 ] ] else : assert ( len ( kernel_spec ) == 2 ) return kernel_spec
expands the kernel spec into a length 2 list .