class_docstr: Do not use this class explicitly.
  
  Instead you should construct its objects with special functions:
  `geocode()`, `geocode_cities()`, `geocode_counties()`, `geocode_states()`,
  `geocode_countries()`, `reverse_geocode()`.
class_docstr_tok: ["Do","not","use","this","class","explicitly",".","Instead","you","should","construct","its","objects","with","special","functions",":","`","geocode","(",")","`",",","`","geocode_cities","(",")","`",",","`","geocode_counties","(",")","`",",","`","geocode_states","(",")","`",",","`","geocode_countries","(",")","`",",","`","reverse_geocode","(",")","`","."]
code: def _build_request(self) -> GeocodingRequest:
      if len(self._names) == 0:
  
          def to_scope(parents):
              if len(parents) == 0:
                  return None
              elif len(parents) == 1:
                  return parents[0]
              else:
                  raise ValueError(
                      "Too many parent objects. Expcted single object instead of {}".format(
                          len(parents)
                      )
                  )
  
          # all countries/states etc. We need one dummy query
          queries = [
              RegionQuery(
                  request=None,
                  country=to_scope(self._countries),
                  state=to_scope(self._states),
                  county=to_scope(self._counties),
              )
          ]
      else:
  
          def assert_parents_size(parents: List, parents_level: str):
              if len(parents) == 0:
                  return
  
              if len(parents) != len(self._names):
                  raise ValueError(
                      "Invalid request: {} count({}) != names count({})".format(
                          parents_level, len(parents), len(self._names)
                      )
                  )
  
          if len(self._countries) > 0 and len(self._scope) > 0:
              raise ValueError(
                  "Invalid request: countries and scope can't be used simultaneously"
              )
  
          assert_parents_size(self._countries, "countries")
          assert_parents_size(self._states, "states")
          assert_parents_size(self._counties, "counties")
  
          queries = []
          for i in range(len(self._names)):
              name = self._names[i]
              country = _get_or_none(self._countries, i)
              state = _get_or_none(self._states, i)
              county = _get_or_none(self._counties, i)
  
              scope, ambiguity_resolver = self._overridings.get(
                  QuerySpec(name, county, state, country),
                  WhereSpec(None, self._default_ambiguity_resolver),
              )
  
              query = RegionQuery(
                  request=name,
                  country=country,
                  state=state,
                  county=county,
                  scope=scope,
                  ambiguity_resolver=ambiguity_resolver,
              )
  
              queries.append(query)
  
      request = (
          RequestBuilder()
          .set_request_kind(RequestKind.geocoding)
          .set_queries(queries)
          .set_scope(self._scope)
          .set_level(self._level)
          .set_namesake_limit(NAMESAKE_MAX_COUNT)
          .set_allow_ambiguous(self._allow_ambiguous)
      )
  
      payload = [
          PayloadKind.limits,
          PayloadKind.poisitions,
          PayloadKind.centroids,
      ]
      if self._highlights:
          payload.append(PayloadKind.highlights)
  
      request.set_requested_payload(payload)
  
      return request.build()
  
imports: from collections import namedtuple
  from collections.abc import Iterable
  from typing import Union, List, Optional, Dict
  from pandas import Series
  from .geocodes import _to_level_kind, request_types, Geocodes, _raise_exception, _ensure_is_list
  from .gis.geocoding_service import GeocodingService
  from .gis.geometry import GeoRect, GeoPoint
  from .gis.request import RequestBuilder, GeocodingRequest, RequestKind, MapRegion, AmbiguityResolver, RegionQuery, LevelKind, IgnoringStrategyKind, PayloadKind, ReverseGeocodingRequest
  from .gis.response import Response, SuccessResponse
  from .type_assertion import assert_list_type
label_desc: Use image node_id 11 for calling the NamesGeocoder obj's underlying member method code with example usage: obj._build_request() and returns: request, None, parents