#NEWLINE# def import_symbol( symbol_path ) : #NEWLINE# #INDENT# " Import the symbol defined by the specified symbol path.\n\n    Examples\n    --------\n\n    import_symbol('tarfile:TarFile') -> TarFile\n    import_symbol('tarfile:TarFile.open') -> TarFile.open\n\n    To allow compatibility with old-school traits symbol names we also allow\n    all-dotted paths, but in this case you can only import top-level names\n    from the module.\n\n    import_symbol('tarfile.TarFile') -> TarFile\n\n    " #NEWLINE# if ( ':' in symbol_path ) : #NEWLINE# #INDENT# ( module_name , symbol_name ) = symbol_path . split ( ':' ) #NEWLINE# module = __import__ ( module_name , { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } , { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } , [ symbol_name ] , 0 ) #NEWLINE# symbol = eval ( symbol_name , module . __dict__ ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# components = symbol_path . split ( '.' ) #NEWLINE# module_name = '.' . join ( components [ : ( - 1 ) ] ) #NEWLINE# symbol_name = components [ ( - 1 ) ] #NEWLINE# module = __import__ ( module_name , { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } , { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } , [ symbol_name ] , 0 ) #NEWLINE# symbol = getattr ( module , symbol_name ) #NEWLINE# #UNINDENT# return symbol