<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def heightmap_kernel_transform( hm: np.ndarray, kernelsize: int, dx: Sequence[int], dy: Sequence[int], weight: Sequence[float], minLevel: float, maxLevel: float, ) -> None: """Apply a generic transformation on the map, so that each resulting cell value is the weighted sum of several neighbour cells. This can be used to smooth/sharpen the map. Args: hm (numpy.ndarray):
 A numpy.ndarray formatted for heightmap functions. kernelsize (int):
 Should be set to the length of the parameters:: dx, dy, and weight. dx (Sequence[int]):
 A sequence of x coorinates. dy (Sequence[int]):
 A sequence of y coorinates. weight (Sequence[float]):
 A sequence of kernelSize cells weight. The value of each neighbour cell is scaled by its corresponding weight minLevel (float):
 No transformation will apply to cells below this value. maxLevel (float):
 No transformation will apply to cells above this value. See examples below for a simple horizontal smoothing kernel : replace value(x,y) with 0.33*value(x-1,y) + 0.33*value(x,y) + 0.33*value(x+1,y). To do this, you need a kernel of size 3 (the sum involves 3 surrounding cells). The dx,dy array will contain: * dx=-1, dy=0 for cell (x-1, y) * dx=1, dy=0 for cell (x+1, y) * dx=0, dy=0 for cell (x, y) * The weight array will contain 0.33 for each cell. Example: """

    cdx = ffi.new("int[]", dx)
    cdy = ffi.new("int[]", dy)
    cweight = ffi.new("float[]", weight)
    lib.TCOD_heightmap_kernel_transform(
        _heightmap_cdata(hm), kernelsize, cdx, cdy, cweight, minLevel, maxLevel
    )