def geocode(query: str) -> tuple[float, float]:
    """
    Geocode place names or addresses to `(lat, lon)` with the Nominatim API.

    This geocodes the query via the Nominatim "search" endpoint.

    Parameters
    ----------
    query
        The query string to geocode.

    Returns
    -------
    point
        The `(lat, lon)` coordinates returned by the geocoder.
    """
    # define the parameters
    params: OrderedDict[str, int | str] = OrderedDict()
    params["format"] = "json"
    params["limit"] = 1
    params["dedupe"] = 0  # prevent deduping to get precise number of results
    params["q"] = query
    response_json = _nominatim._nominatim_request(params=params)

    # if results were returned, parse lat and lon out of the result
    if response_json and "lat" in response_json[0] and "lon" in response_json[0]:
        lat = float(response_json[0]["lat"])
        lon = float(response_json[0]["lon"])
        point = (lat, lon)

        msg = f"Geocoded {query!r} to {point}"
        utils.log(msg, level=lg.INFO)
        return point

    # otherwise we got no results back
    msg = f"Nominatim could not geocode query {query!r}."
    raise InsufficientResponseError(msg)

    Geocode place names or addresses to `(lat, lon)` with the Nominatim API.

    This geocodes the query via the Nominatim "search" endpoint.

    Parameters
    ----------
    query
        The query string to geocode.

    Returns
    -------
    point
        The `(lat, lon)` coordinates returned by the geocoder.
    
osmnx/geocoder.py