code: def validate_bucket(self):
          
          log = logging.getLogger(self.cls_logger + '.validate_bucket')
          log.info('Attempting to get bucket: {b}'.format(b=self.bucket_name))
          max_tries = 10
          count = 1
          while count <= max_tries:
              log.info('Attempting to connect to S3 bucket %s, try %s of %s',
                       self.bucket_name, count, max_tries)
              try:
                  self.s3client.head_bucket(Bucket=self.bucket_name)
              except ClientError as e:
                  _, ex, trace = sys.exc_info()
                  error_code = int(e.response['Error']['Code'])
                  log.debug(
                      'Connecting to bucket %s produced response code: %s',
                      self.bucket_name, error_code)
                  if error_code == 404:
                      msg = 'Error 404 response indicates that bucket {b} does not ' \
                            'exist:\n{e}'.format(b=self.bucket_name, e=str(ex))
                      log.error(msg)
                      raise S3UtilError, msg, trace
                  elif error_code == 500 or error_code == 503:
                      if count >= max_tries:
                          msg = 'S3 bucket is not accessible at this time: {b}\n{e}'.format(
                              b=self.bucket_name, e=str(ex))
                          log.error(msg)
                          raise S3UtilError, msg, trace
                      else:
                          log.warn('AWS returned error code 500 or 503, re-trying in 2 sec...')
                          time.sleep(5)
                          count += 1
                          continue
                  else:
                      msg = 'Connecting to S3 bucket {b} returned code: {c}\n{e}'.\
                          format(b=self.bucket_name, c=error_code, e=str(ex))
                      log.error(msg)
                      raise S3UtilError, msg, trace
              else:
                  log.info('Found bucket: %s', self.bucket_name)
                  return
docs: Verify the specified bucket exists
  
          This method validates that the bucket name passed in the S3Util
          constructor actually exists.
  
          :return: None