def geocode_location(location, sensor=False, api_key=None):
params = {'<STR_LIT:address>': location, '<STR_LIT>': str(sensor).lower()}<EOL>if api_key is not None:<EOL><INDENT>params['<STR_LIT:key>'] = api_key<EOL><DEDENT>url, geo_response = _fetch_remote_json(<EOL>GooglePlaces.GEOCODE_API_URL, params)<EOL>_validate_response(url, geo_response)<EOL>if geo_response['<STR_LIT:status>'] == GooglePlaces.RESPONSE_STATUS_ZERO_RESULTS:<EOL><INDENT>error_detail = ('<STR_LIT>' %<EOL>location)<EOL>raise GooglePlacesError(error_detail)<EOL><DEDENT>return geo_response['<STR_LIT>'][<NUM_LIT:0>]['<STR_LIT>']['<STR_LIT:location>']<EOL>
Converts a human-readable location to lat-lng.

    Returns a dict with lat and lng keys.

    keyword arguments:
    location -- A human-readable location, e.g 'London, England'
    sensor   -- Boolean flag denoting if the location came from a device using
                its' location sensor (default False)
    api_key  -- A valid Google Places API key. 

    raises:
    GooglePlacesError -- if the geocoder fails to find a location.