def snap_bounds(bounds=None, pyramid=None, zoom=None):
if not isinstance(bounds, (tuple, list)):<EOL><INDENT>raise TypeError("<STR_LIT>")<EOL><DEDENT>if len(bounds) != <NUM_LIT:4>:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if not isinstance(pyramid, BufferedTilePyramid):<EOL><INDENT>raise TypeError("<STR_LIT>")<EOL><DEDENT>bounds = Bounds(*bounds)<EOL>lb = pyramid.tile_from_xy(bounds.left, bounds.bottom, zoom, on_edge_use="<STR_LIT>").bounds<EOL>rt = pyramid.tile_from_xy(bounds.right, bounds.top, zoom, on_edge_use="<STR_LIT>").bounds<EOL>return Bounds(lb.left, lb.bottom, rt.right, rt.top)<EOL>
Snaps bounds to tiles boundaries of specific zoom level.

Parameters
----------
bounds : bounds to be snapped
pyramid : TilePyramid
zoom : int

Returns
-------
Bounds(left, bottom, right, top)