def format_err_msg_and_raise(operation_type, component, error_message, error_code):
 formated_err_msg = (_('Error: Failed to %(operation_type)s %(component)s') % {'operation_type': operation_type, 'component': component})
 if (error_message.startswith('"\'') and error_message.endswith('\'"')):
  error_message = error_message[2:(len(error_message) - 2)]
 formated_err_msg = ((formated_err_msg + '\nReason:') + error_message)
 raise CoprHdError(error_code, formated_err_msg)

def format_err_msg_and_raise ( operation_type , component , error_message , error_code ) : formated_err_msg = ( _ ( 'Error: Failed to %(operation_type)s %(component)s' ) % { 'operation_type' : operation_type , 'component' : component } ) if ( error_message . startswith ( '"\'' ) and error_message . endswith ( '\'"' ) ) : error_message = error_message [ 2 : ( len ( error_message ) - 2 ) ] formated_err_msg = ( ( formated_err_msg + '\nReason:' ) + error_message ) raise CoprHdError ( error_code , formated_err_msg )
method to format error message .