def tile_coords_and_zoom_to_quadKey(TileX, TileY, zoom):
    """
    The function to create a quadkey for use with certain tileservers that use them, e.g. Bing

    Parameters
    ----------
    TileX : int
         x coordinate of tile
    TileY : int
         y coordinate of tile
    zoom : int
        tile map service zoom level

    Returns
    -------
    quadKey : str
    """

    quadKey = ''
    for i in range(zoom, 0, -1):
        digit = 0
        mask = 1 << (i - 1)
        if (TileX & mask) != 0:
            digit += 1
        if (TileY & mask) != 0:
            digit += 2
        quadKey += str(digit)
    return quadKey