<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _gauss_filter(data, sigma=4, res_g=None, sub_blocks=(1, 1, 1)):
 """ gaussian filter of given size Parameters data: 2 or 3 dimensional ndarray or OCLArray of type float32 input data size: scalar, tuple the size of the patch to consider res_g: OCLArray store result in buffer if given sub_blocks: perform over subblock tiling (only if data is ndarray) Returns ------- filtered image or None (if OCLArray) """

    truncate = 4.
    radius = tuple(int(truncate*s +0.5) for s in sigma)
    size = tuple(2*r+1 for r in radius)

    s = sigma[0]

    if data.ndim == 2:
        _filt = make_filter(_generic_filter_gpu_2d(FUNC="res+(val*native_exp((float)(-(ht-%s)*(ht-%s)/2/%s/%s)))"%(size[0]//2,size[0]//2,s,s), DEFAULT="0.f"))
    elif data.ndim == 3:
        _filt = make_filter(_generic_filter_gpu_3d(FUNC="res+(val*native_exp((float)(-(ht-%s)*(ht-%s)/2/%s/%s)))"%(size[0]//2,size[0]//2,s,s), DEFAULT="0.f"))

    else:
        raise ValueError("currently only 2 or 3 dimensional data is supported")
    return _filt(data=data, size=size, res_g=res_g, sub_blocks=sub_blocks)