def text_search(self, query=None, language=lang.ENGLISH, lat_lng=None,<EOL>radius=<NUM_LIT>, type=None, types=[], location=None, pagetoken=None):
self._request_params = {'<STR_LIT>': query}<EOL>if lat_lng is not None or location is not None:<EOL><INDENT>lat_lng_str = self._generate_lat_lng_string(lat_lng, location)<EOL>self._request_params['<STR_LIT:location>'] = lat_lng_str<EOL><DEDENT>self._request_params['<STR_LIT>'] = radius<EOL>if type:<EOL><INDENT>self._request_params['<STR_LIT:type>'] = type<EOL><DEDENT>elif types:<EOL><INDENT>if len(types) == <NUM_LIT:1>:<EOL><INDENT>self._request_params['<STR_LIT:type>'] = types[<NUM_LIT:0>]<EOL><DEDENT>elif len(types) > <NUM_LIT:1>:<EOL><INDENT>self._request_params['<STR_LIT>'] = '<STR_LIT:|>'.join(types)<EOL><DEDENT><DEDENT>if language is not None:<EOL><INDENT>self._request_params['<STR_LIT>'] = language<EOL><DEDENT>if pagetoken is not None:<EOL><INDENT>self._request_params['<STR_LIT>'] = pagetoken<EOL><DEDENT>self._add_required_param_keys()<EOL>url, places_response = _fetch_remote_json(<EOL>GooglePlaces.TEXT_SEARCH_API_URL, self._request_params)<EOL>_validate_response(url, places_response)<EOL>return GooglePlacesSearchResult(self, places_response)<EOL>
Perform a text search using the Google Places API.

        Only the one of the query or pagetoken kwargs are required, the rest of the 
        keyword arguments are optional.

        keyword arguments:
        lat_lng  -- A dict containing the following keys: lat, lng
                    (default None)
        location -- A human readable location, e.g 'London, England'
                    (default None)
        pagetoken-- Optional parameter to force the search result to return the next
                    20 results from a previously run search. Setting this parameter 
                    will execute a search with the same parameters used previously. 
                    (default None)
        radius   -- The radius (in meters) around the location/lat_lng to
                    restrict the search to. The maximum is 50000 meters.
                    (default 3200)
        query    -- The text string on which to search, for example:
                    "Restaurant in New York".
        type     -- Optional type param used to indicate place category.
        types    -- An optional list of types, restricting the results to
                    Places (default []). If there is only one item the request
                    will be send as type param.