def center(map, object):
    """
    Center an ee.Image or ee.Feature on the map.

    Args:

        map: The map to center the object on.

        object: The ee.Image or ee.Feature to center.

    Returns:
         The provided map.

    """
    coordinates = object.geometry().bounds().coordinates().getInfo()[0]
    bounds = [[point[1], point[0]] for point in coordinates]
    map.fit_bounds(bounds)
    return map