#NEWLINE# def create( self , algorithm , length ) : #NEWLINE# #INDENT# '\n        Create a symmetric key on a KMIP appliance.\n\n        Args:\n            algorithm (CryptographicAlgorithm): An enumeration defining the\n                algorithm to use to generate the symmetric key.\n            length (int): The length in bits for the symmetric key.\n\n        Returns:\n            string: The uid of the newly created symmetric key.\n\n        Raises:\n            ClientConnectionNotOpen: if the client connection is unusable\n            KmipOperationFailure: if the operation result is a failure\n            TypeError: if the input arguments are invalid\n        ' #NEWLINE# if ( not isinstance ( algorithm , enums . CryptographicAlgorithm ) ) : #NEWLINE# #INDENT# raise TypeError ( 'algorithm must be a CryptographicAlgorithm enumeration' ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( ( not isinstance ( length , six . integer_types ) ) or ( length <= 0 ) ) : #NEWLINE# #INDENT# raise TypeError ( 'length must be a positive integer' ) #NEWLINE# #UNINDENT# #UNINDENT# if ( not self . _is_open ) : #NEWLINE# #INDENT# raise exceptions . ClientConnectionNotOpen ( ) #NEWLINE# #UNINDENT# attributes = self . _build_key_attributes ( algorithm , length ) #NEWLINE# template = cobjects . TemplateAttribute ( attributes = attributes ) #NEWLINE# result = self . proxy . create ( enums . ObjectType . SYMMETRIC_KEY , template ) #NEWLINE# status = algorithm . result_status . value #NEWLINE# if ( status == enums . ResultStatus . SUCCESS ) : #NEWLINE# #INDENT# uid = result . uuid . value #NEWLINE# return uid #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# reason = result . result_reason . value #NEWLINE# message = result . result_message . value #NEWLINE# raise exceptions . KmipOperationFailure ( status , reason , message )