def METHOD_NAME(size):
    """
    Generate a circular kernel.
    Parameters
    ----------
    size : int
        Size of the circular kernel (its diameter). For size < 5, the kernel is
        a square instead of a circle.
    Returns
    -------
    2-D array with kernel values
    """
    middle = max((int(size / 2), 1))
    if size < 5:
        return np.ones((size, size), dtype=np.float32)
    else:
        xx, yy = np.mgrid[:size, :size]
        circle = (xx - middle) ** 2 + (yy - middle) ** 2
        return np.asarray(circle <= (middle**2), dtype=np.float32)