docs: def __get_connection_dynamodb(retries=3):
      """ Ensure connection to DynamoDB
  
      :type retries: int
      :param retries: Number of times to retry to connect to DynamoDB
      """
      connected = False
      region = get_global_option('region')
  
      while not connected:
          if (get_global_option('aws_access_key_id') and
                  get_global_option('aws_secret_access_key')):
              logger.debug(
                  'Authenticating to DynamoDB using '
                  'credentials in configuration file')
              connection = dynamodb2.connect_to_region(
                  region,
                  aws_access_key_id=get_global_option('aws_access_key_id'),
                  aws_secret_access_key=get_global_option(
                      'aws_secret_access_key'))
          else:
              logger.debug(
                  'Authenticating using boto\'s authentication handler')
              connection = dynamodb2.connect_to_region(region)
  
          if not connection:
              if retries == 0:
                  logger.error('Failed to connect to DynamoDB. Giving up.')
                  raise
              else:
                  logger.error(
                      'Failed to connect to DynamoDB. Retrying in 5 seconds')
                  retries -= 1
                  time.sleep(5)
          else:
              connected = True
              logger.debug('Connected to DynamoDB in {0}'.format(region))
  
      return connection