def ensure_s3_bucket(name, region=''):
 bucket = ('s3://' + name)
 list_result = run_quick(('aws s3 ls ' + bucket), echo=False)
 if (not list_result.returncode):
  sys.stderr.write('WARNING: "{bucket}" already exists. Overwriting.\n'.format(bucket=bucket))
 else:
  print 'Creating S3 bucket "{bucket}"'.format(bucket=bucket)
  command = ('aws s3 mb ' + bucket)
  if region:
   command += (' --region ' + region)
  check_run_quick(command, echo=False)

def ensure_s3_bucket ( name , region = '' ) : bucket = ( 's3://' + name ) list_result = run_quick ( ( 'aws s3 ls ' + bucket ) , echo = False ) if ( not list_result . returncode ) : sys . stderr . write ( 'WARNING: "{bucket}" already exists. Overwriting.\n' . format ( bucket = bucket ) ) else : print 'Creating S3 bucket "{bucket}"' . format ( bucket = bucket ) command = ( 'aws s3 mb ' + bucket ) if region : command += ( ' --region ' + region ) check_run_quick ( command , echo = False )
ensure that the desired s3 bucket exists .