':param key: Maps API key. Required, unless "client_id" and
"client_secret" are set.
:type key: string
:param client_id: (for Maps API for Work customers) Your client ID.
:type client_id: string
:param client_secret: (for Maps API for Work customers) Your client
secret (base64 encoded).
:type client_secret: string
:param channel: (for Maps API for Work customers) When set, a channel
parameter with this value will be added to the requests.
This can be used for tracking purpose.
Can only be used with a Maps API client ID.
:type channel: str
:param timeout: Combined connect and read timeout for HTTP requests, in
seconds. Specify "None" for no timeout.
:type timeout: int
:param connect_timeout: Connection timeout for HTTP requests, in
seconds. You should specify read_timeout in addition to this option.
Note that this requires requests >= 2.4.0.
:type connect_timeout: int
:param read_timeout: Read timeout for HTTP requests, in
seconds. You should specify connect_timeout in addition to this
option. Note that this requires requests >= 2.4.0.
:type read_timeout: int
:param retry_timeout: Timeout across multiple retriable requests, in
seconds.
:type retry_timeout: int
:param queries_per_second: Number of queries per second permitted.
If the rate limit is reached, the client will sleep for the
appropriate amount of time before it runs the current query.
:type queries_per_second: int
:raises ValueError: when either credentials are missing, incomplete
or invalid.
:raises NotImplementedError: if connect_timeout and read_timeout are
used with a version of requests prior to 2.4.0.
:param requests_kwargs: Extra keyword arguments for the requests
library, which among other things allow for proxy auth to be
implemented. See the official requests docs for more info:
http://docs.python-requests.org/en/latest/api/#main-interface
:type requests_kwargs: dict'

def __init__(self, key=None, client_id=None, client_secret=None, timeout=None, connect_timeout=None, read_timeout=None, retry_timeout=60, requests_kwargs=None, queries_per_second=10, channel=None):

    if ((not key) and (not (client_secret and client_id))):
        raise ValueError('Must    provide    API    key    or    enterprise    credentials    when    creating    client.')
    if (key and (not key.startswith('AIza'))):
        raise ValueError('Invalid    API    key    provided.')
    if channel:
        if (not client_id):
            raise ValueError('The    channel    argument    must    be    used    with    a    client    ID')
        if (not re.match('^[a-zA-Z0-9._-]*$', channel)):
            raise ValueError('The    channel    argument    must    be    an    ASCII    alphanumeric    string.    The    period    (.),    underscore    (_)and    hyphen    (-)    characters    are    allowed.')
    self.session = requests.Session()
    self.key = key
    if (timeout and (connect_timeout or read_timeout)):
        raise ValueError('Specify    either    timeout,    or    connect_timeout    and    read_timeout')
    if (connect_timeout and read_timeout):
        chunks = requests.__version__.split('.')
        if ((int(chunks[0]) < 2) or ((int(chunks[0]) == 2) and (int(chunks[1]) < 4))):
            raise NotImplementedError('Connect/Read    timeouts    require    requests    v2.4.0    or    higher')
        self.timeout = (connect_timeout, read_timeout)
    else:
        self.timeout = timeout
    self.client_id = client_id
    self.client_secret = client_secret
    self.channel = channel
    self.retry_timeout = timedelta(seconds=retry_timeout)
    self.requests_kwargs = (requests_kwargs or {})
    self.requests_kwargs.update({'headers': {'User-Agent': _USER_AGENT}, 'timeout': self.timeout, 'verify': True})
    self.queries_per_second = queries_per_second
    self.sent_times = collections.deque('', queries_per_second)
