def dirac(x, y, tol=2e-2, bounds=None):
    """Creates a
    
    Parameters
    ----------
    x : int, float
        Horizontal position of the Dirac.
    y : int, float
        Vertical position of the Dirac.
    tol : float, optional
        Small offset around the position to avoid completely null Dirac if no
        vertex falls on the precise position.
    bounds : list[int or float, int or float, int or float, int or float] or None, optional
        Clamping bounds for the Dirac, if necessary.
    """
    xmin, xmax = x - tol, x + tol
    ymin, ymax = y - tol, y + tol
    if bounds is not None:
        xmin = max(xmin, bounds[0])
        xmax = min(xmax, bounds[1])
        ymin = max(ymin, bounds[2])
        ymax = min(ymax, bounds[3])
    return lambda x,y: 1. if (xmin <= x <= xmax and ymin <= y <= ymax) else 0.