def get_err_response(code):
 error_table = {'AccessDenied': (HTTP_FORBIDDEN, 'Access denied'), 'BucketAlreadyExists': (HTTP_CONFLICT, 'The requested bucket name is not available'), 'BucketNotEmpty': (HTTP_CONFLICT, 'The bucket you tried to delete is not empty'), 'InvalidArgument': (HTTP_BAD_REQUEST, 'Invalid Argument'), 'InvalidBucketName': (HTTP_BAD_REQUEST, 'The specified bucket is not valid'), 'InvalidURI': (HTTP_BAD_REQUEST, 'Could not parse the specified URI'), 'InvalidDigest': (HTTP_BAD_REQUEST, 'The Content-MD5 you specified was invalid'), 'BadDigest': (HTTP_BAD_REQUEST, 'The Content-Length you specified was invalid'), 'NoSuchBucket': (HTTP_NOT_FOUND, 'The specified bucket does not exist'), 'SignatureDoesNotMatch': (HTTP_FORBIDDEN, 'The calculated request signature does not match your provided one'), 'RequestTimeTooSkewed': (HTTP_FORBIDDEN, 'The difference between the request time and the current time is too large'), 'NoSuchKey': (HTTP_NOT_FOUND, 'The resource you requested does not exist'), 'Unsupported': (HTTP_NOT_IMPLEMENTED, 'The feature you requested is not yet implemented'), 'MissingContentLength': (HTTP_LENGTH_REQUIRED, 'Length Required'), 'ServiceUnavailable': (HTTP_SERVICE_UNAVAILABLE, 'Please reduce your request rate')}
 resp = Response(content_type='text/xml')
 resp.status = error_table[code][0]
 resp.body = ('<?xml version="1.0" encoding="UTF-8"?>\r\n<Error>\r\n  <Code>%s</Code>\r\n  <Message>%s</Message>\r\n</Error>\r\n' % (code, error_table[code][1]))
 return resp

def get_err_response ( code ) : error_table = { 'AccessDenied' : ( HTTP_FORBIDDEN , 'Access denied' ) , 'BucketAlreadyExists' : ( HTTP_CONFLICT , 'The requested bucket name is not available' ) , 'BucketNotEmpty' : ( HTTP_CONFLICT , 'The bucket you tried to delete is not empty' ) , 'InvalidArgument' : ( HTTP_BAD_REQUEST , 'Invalid Argument' ) , 'InvalidBucketName' : ( HTTP_BAD_REQUEST , 'The specified bucket is not valid' ) , 'InvalidURI' : ( HTTP_BAD_REQUEST , 'Could not parse the specified URI' ) , 'InvalidDigest' : ( HTTP_BAD_REQUEST , 'The Content-MD5 you specified was invalid' ) , 'BadDigest' : ( HTTP_BAD_REQUEST , 'The Content-Length you specified was invalid' ) , 'NoSuchBucket' : ( HTTP_NOT_FOUND , 'The specified bucket does not exist' ) , 'SignatureDoesNotMatch' : ( HTTP_FORBIDDEN , 'The calculated request signature does not match your provided one' ) , 'RequestTimeTooSkewed' : ( HTTP_FORBIDDEN , 'The difference between the request time and the current time is too large' ) , 'NoSuchKey' : ( HTTP_NOT_FOUND , 'The resource you requested does not exist' ) , 'Unsupported' : ( HTTP_NOT_IMPLEMENTED , 'The feature you requested is not yet implemented' ) , 'MissingContentLength' : ( HTTP_LENGTH_REQUIRED , 'Length Required' ) , 'ServiceUnavailable' : ( HTTP_SERVICE_UNAVAILABLE , 'Please reduce your request rate' ) } resp = Response ( content_type = 'text/xml' ) resp . status = error_table [ code ] [ 0 ] resp . body = ( '<?xml version="1.0" encoding="UTF-8"?>\r\n<Error>\r\n  <Code>%s</Code>\r\n  <Message>%s</Message>\r\n</Error>\r\n' % ( code , error_table [ code ] [ 1 ] ) ) return resp
given an http response code .