def validate_ascii_metadata(params, **kwargs):
 metadata = params.get('Metadata')
 if ((not metadata) or (not isinstance(metadata, dict))):
  return
 for (key, value) in metadata.items():
  try:
   key.encode('ascii')
   value.encode('ascii')
  except UnicodeEncodeError as e:
   error_msg = ('Non ascii characters found in S3 metadata for key "%s", value: "%s".  \nS3 metadata can only contain ASCII characters. ' % (key, value))
   raise ParamValidationError(report=error_msg)

def validate_ascii_metadata ( params , ** kwargs ) : metadata = params . get ( 'Metadata' ) if ( ( not metadata ) or ( not isinstance ( metadata , dict ) ) ) : return for ( key , value ) in metadata . items ( ) : try : key . encode ( 'ascii' ) value . encode ( 'ascii' ) except UnicodeEncodeError as e : error_msg = ( 'Non ascii characters found in S3 metadata for key "%s", value: "%s".  \nS3 metadata can only contain ASCII characters. ' % ( key , value ) ) raise ParamValidationError ( report = error_msg )
verify s3 metadata only contains ascii characters .