def LongitudinalBounds(lng, num_tiles):
  """Return west/east bounds of tile containing given longitude.

  Args:
    lng: (float) Longitude in degrees.
    num_tiles: (integer) Number of tiles in the tile grid.
  Returns:
    Tuple of (west, east) bounds.
  """
  # Normalize to between -180 and 180 degrees longitude.
  while lng < -180.0:
    lng += 360.0
  while lng >= 180.0:
    lng -= 360.0

  degrees_per_tile = 360.0 / num_tiles
  x = int((lng + 180.0) / degrees_per_tile)
  west = x * degrees_per_tile - 180.0
  return (west, west + degrees_per_tile)