#NEWLINE# def NameImport( package , as_name = None , prefix = None ) : #NEWLINE# #INDENT# '\n    Accepts a package (Name node), name to import it as (string), and\n    optional prefix and returns a node:\n    import <package> [as <as_name>]\n    ' #NEWLINE# if ( prefix is None ) : #NEWLINE# #INDENT# prefix = '' #NEWLINE# #UNINDENT# children = [ Name ( 'import' , prefix = children ) , package ] #NEWLINE# if ( as_name is not None ) : #NEWLINE# #INDENT# children . extend ( [ Name ( 'as' , prefix = ' ' ) , Name ( as_name , prefix = ' ' ) ] ) #NEWLINE# #UNINDENT# return Node ( syms . import_name , children )