code: def dynamodb_connection_factory():
      
  
      global _DYNAMODB_CONN
      global _BOTO_SESSION
      if not _DYNAMODB_CONN:
          logger.debug("Creating a DynamoDB connection.")
          if not _BOTO_SESSION:
              _BOTO_SESSION = Boto3Session(
                  aws_access_key_id=AWS_ACCESS_KEY_ID,
                  aws_secret_access_key=AWS_SECRET_ACCESS_KEY,
                  region_name=AWS_REGION_NAME)
          _DYNAMODB_CONN = _BOTO_SESSION.resource('dynamodb')
      return _DYNAMODB_CONN
docs: Since SessionStore is called for every single page view, we'd be
      establishing new connections so frequently that performance would be
      hugely impacted. We'll lazy-load this here on a per-worker basis. Since
      boto3.resource.('dynamodb')objects are state-less (aside from security
      tokens), we're not too concerned about thread safety issues.