def add_scales_bar(img, bbox):
    """
    Add a scales bar to the  map.

    Calculates the resolution at the current latitude and
    inserts the corresponding scales bar on the map.

    Args:
        img (Image): Image object to which the scales bar will be added.
        bbox (TileBB): boundaries of the map

    """
    tc = TileCoordinate(bbox.min.zoom, bbox.min.x, bbox.min.y)
    meters_per_pixel = tc.resolution()
    one_km_bar = int(1000 * (1 / meters_per_pixel))
    col_black = (0, 0, 0)

    line_start = (100, img.size[1] - 100)  # px
    line_end = (line_start[0] + one_km_bar, line_start[1])
    whiskers_left = [line_start[0], line_start[1] - 15, line_start[0], line_start[1] + 15]
    whiskers_right = [line_end[0], line_end[1] - 15, line_end[0], line_end[1] + 15]

    draw = ImageDraw.Draw(img)
    draw.line([line_start, line_end], fill=col_black, width=5)
    draw.line(whiskers_left, fill=col_black, width=2)
    draw.line(whiskers_right, fill=col_black, width=2)
    draw.text((line_start[0] + 10, line_start[1] + 10), fill=col_black, text="1 km")
    del draw
Add a scales bar to the  map.

    Calculates the resolution at the current latitude and
    inserts the corresponding scales bar on the map.

    Args:
        img (Image): Image object to which the scales bar will be added.
        bbox (TileBB): boundaries of the map