<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def snap_bounds(bounds=None, tile_pyramid=None, zoom=None, pixelbuffer=0):
 """ Extend bounds to be aligned with union of tile bboxes. - bounds: (left, bottom, right, top) - tile_pyramid: a TilePyramid object - zoom: target zoom level - pixelbuffer: apply pixelbuffer """

    bounds = Bounds(*bounds)
    validate_zoom(zoom)
    lb = _tile_from_xy(tile_pyramid, bounds.left, bounds.bottom, zoom, on_edge_use="rt")
    rt = _tile_from_xy(tile_pyramid, bounds.right, bounds.top, zoom, on_edge_use="lb")
    left, bottom, _, _ = lb.bounds(pixelbuffer)
    _, _, right, top = rt.bounds(pixelbuffer)
    return Bounds(left, bottom, right, top)