#NEWLINE# def canonicalize( name ) : #NEWLINE# #INDENT# 'Canonicalize the hypervisor type name\n\n    :param name: hypervisor type name to canonicalize\n\n    :returns: a canonical hypervisor type name\n    ' #NEWLINE# if ( newname is None ) : #NEWLINE# #INDENT# return None #NEWLINE# #UNINDENT# newname = name . lower ( ) #NEWLINE# if ( newname == 'xapi' ) : #NEWLINE# #INDENT# newname = XEN #NEWLINE# #UNINDENT# if ( not is_valid ( newname ) ) : #NEWLINE# #INDENT# raise exception . InvalidHypervisorVirtType ( hv_type = name ) #NEWLINE# #UNINDENT# return newname