def _places(
    client,
    url_part,
    query=None,
    location=None,
    radius=None,
    keyword=None,
    language=None,
    min_price=0,
    max_price=4,
    name=None,
    open_now=False,
    rank_by=None,
    type=None,
    region=None,
    page_token=None,
):
    """
    Internal handler for ``places`` and ``places_nearby``.
    See each method's docs for arg details.
    """

    params = {"minprice": min_price, "maxprice": max_price}

    if query:
        params["query"] = query
    if location:
        params["location"] = convert.latlng(location)
    if radius:
        params["radius"] = radius
    if keyword:
        params["keyword"] = keyword
    if language:
        params["language"] = language
    if name:
        params["name"] = convert.join_list(" ", name)
    if open_now:
        params["opennow"] = "true"
    if rank_by:
        params["rankby"] = rank_by
    if type:
        params["type"] = type
    if region:
        params["region"] = region
    if page_token:
        params["pagetoken"] = page_token

    url = "/maps/api/place/%ssearch/json" % url_part
    return client._request(url, params)

    Internal handler for ``places`` and ``places_nearby``.
    See each method's docs for arg details.
    
googlemaps/places.py