#NEWLINE# def load_class_by_alias_or_classname( namespace , name ) : #NEWLINE# #INDENT# 'Load class using stevedore alias or the class name\n    :param namespace: namespace where the alias is defined\n    :param name: alias or class name of the class to be loaded\n    :returns class if calls can be loaded\n    :raises ImportError if class cannot be loaded\n    ' #NEWLINE# if ( not name ) : #NEWLINE# #INDENT# LOG . error ( _LE ( 'Alias or class name is not set' ) ) #NEWLINE# raise ImportError ( _ ( 'Class not found.' ) ) #NEWLINE# #UNINDENT# try : #NEWLINE# #INDENT# mgr = driver . DriverManager ( namespace , e1_info ) #NEWLINE# class_to_load = mgr . driver #NEWLINE# #UNINDENT# except RuntimeError : #NEWLINE# #INDENT# e1_info = sys . exc_info ( ) #NEWLINE# try : #NEWLINE# #INDENT# class_to_load = importutils . import_class ( name ) #NEWLINE# #UNINDENT# except ( ImportError , ValueError ) : #NEWLINE# #INDENT# LOG . error ( _LE ( 'Error loading class by alias' ) , exc_info = e1_info ) #NEWLINE# LOG . error ( _LE ( 'Error loading class by class name' ) , exc_info = True ) #NEWLINE# raise ImportError ( _ ( 'Class not found.' ) ) #NEWLINE# #UNINDENT# #UNINDENT# return class_to_load