def get_tile_coords_from_tuple(options, t):
 x = 0
 y = 0
 z = options.zoom_level
 n = 1
 for i in t:
  if (i == 1):
   x += (2 ** (z - n))
  elif (i == 2):
   y += (2 ** (z - n))
  elif (i == 3):
   x += (2 ** (z - n))
   y += (2 ** (z - n))
  n += 1
 return (x, y)

def get_tile_coords_from_tuple ( options , t ) : x = 0 y = 0 z = options . zoom_level n = 1 for i in t : if ( i == 1 ) : x += ( 2 ** ( z - n ) ) elif ( i == 2 ) : y += ( 2 ** ( z - n ) ) elif ( i == 3 ) : x += ( 2 ** ( z - n ) ) y += ( 2 ** ( z - n ) ) n += 1 return ( x , y )
gets a tuple of coords from get_tuple_coords and returns the number of tiles from the top left corner to this tile .