'Snap all points of the input geometry to the grid.  How the
geometry is snapped to the grid depends on how many arguments
were given:
- 1 argument : A single size to snap both the X and Y grids to.
- 2 arguments: X and Y sizes to snap the grid to.
- 4 arguments: X, Y sizes and the X, Y origins.'

def snap_to_grid(self, *args, **kwargs):

    if (False in [isinstance(arg, ((float,) + six.integer_types)) for arg in args]):
        raise TypeError('Size    argument(s)    for    the    grid    must    be    a    float    or    integer    values.')
    nargs = len(args)
    if (nargs == 1):
        size = args[0]
        procedure_fmt = '%(geo_col)s,%(size)s'
        procedure_args = {'size': size}
    elif (nargs == 2):
        (xsize, ysize) = args
        procedure_fmt = '%(geo_col)s,%(xsize)s,%(ysize)s'
        procedure_args = {'xsize': xsize, 'ysize': ysize}
    elif (nargs == 4):
        (xsize, ysize, xorigin, yorigin) = args
        procedure_fmt = '%(geo_col)s,%(xorigin)s,%(yorigin)s,%(xsize)s,%(ysize)s'
        procedure_args = {'xsize': xsize, 'ysize': ysize, 'xorigin': xorigin, 'yorigin': yorigin}
    else:
        raise ValueError('Must    provide    1,    2,    or    4    arguments    to    `snap_to_grid`.')
    s = {'procedure_fmt': procedure_fmt, 'procedure_args': procedure_args, 'select_field': GeomField()}
    return self._spatial_attribute('snap_to_grid', s, **kwargs)
