code: def tile_to_quadkey(tile, level):
          
          tile_x = tile[0]
          tile_y = tile[1]
          quadkey = ""
          for i in xrange(level):
              bit = level - i
              digit = ord('0')
              mask = 1 << (bit - 1)  # if (bit - 1) > 0 else 1 >> (bit - 1)
              if (tile_x & mask) is not 0:
                  digit += 1
              if (tile_y & mask) is not 0:
                  digit += 2
              quadkey += chr(digit)
          return quadkey
docs: Transform tile coordinates to a quadkey