def _Dynamic_GetAccessToken(self, request, response):
    scope = ' '.join(request.scope_list())
    with self.__access_token_cache_lock:
      rv = self.__access_token_cache.get(scope, None)
    now = int(time.time())



    if not (rv and rv['expires'] > (now + 60)):

      assertion_input = '%s.%s' % (
          base64.urlsafe_b64encode(json.dumps({
              'alg': 'RS256',
              'typ': 'JWT'
          }).encode('UTF-8')).rstrip('='),
          base64.urlsafe_b64encode(json.dumps({
              'iss': self.__email_address,
              'scope': scope,
              'aud': self.__oauth_url,
              'exp': now + (60 * 60),
              'iat': now
          }).encode('UTF-8')).rstrip('='))


      signature = base64.urlsafe_b64encode(rsa.pkcs1.sign(
          assertion_input, self.__private_key, 'SHA-256')).rstrip('=')


      message = urllib.urlencode({
          'grant_type': 'urn:ietf:params:oauth:grant-type:jwt-bearer',
          'assertion': '%s.%s' % (assertion_input, signature)
      })

      resp = urlfetch.fetch(
          url=self.__oauth_url,
          validate_certificate=True,
          payload=message,
          method=urlfetch.POST,
          headers={'Content-Type': 'application/x-www-form-urlencoded'})

      if resp.status_code != 200:
        raise apiproxy_errors.ApplicationError(
            app_identity_service_pb.AppIdentityServiceError.UNKNOWN_ERROR,
            'Error getting access token. Response code: %i, Content: %s' % (
                resp.status_code, resp.content))

      rv = json.loads(resp.content)


      rv['expires'] = now + int(rv.get('expires_in', '0'))
      with self.__access_token_cache_lock:
        self.__access_token_cache[scope] = rv

    response.set_access_token(rv['access_token'])
    response.set_expiration_time(rv['expires'])
Test multiple boolean operators in condition without parens.
dataset/ETHPy150Open GoogleCloudPlatform/python-compat-runtime/appengine-compat/exported_appengine_sdk/google/appengine/api/app_identity/app_identity_keybased_stub.py/KeyBasedAppIdentityServiceStub._Dynamic_GetAccessToken--crossover with--dataset/ETHPy150Open kuri65536/python-for-android/python-modules/twisted/twisted/words/test/test_xpath.py/XPathTest.test_booleanOperatorsNoParens