def _tile_url(tile_format, x, y, zoom):
    """Build S3 URL prefix

    The S3 bucket is organized {tile_format}/{z}/{x}/{y}.tif

    Parameters
    ----------
    tile_format : str
        One of 'terrarium', 'normal', 'geotiff'
    zoom : int
        zoom level
    x : int
        x tilespace coordinate
    y : int
        x tilespace coordinate

    Returns
    -------
    str
        Bucket prefix

    Raises
    ------
    TypeError
    """

    tile_url = "{tile_format}/{zoom}/{x}/{y}.{ext}"
    ext = {"geotiff": "tif", "normal": "png", "terrarium": "png"}

    return tile_url.format(tile_format=tile_format, zoom=zoom, x=x, y=y, ext=ext[tile_format])