#NEWLINE# def _package_path( name ) : #NEWLINE# #INDENT# 'Returns the path to the package containing the named module or\n    None if the path could not be identified (e.g., if\n    ``name == "__main__"``).\n    ' #NEWLINE# loader = pkgutil . get_loader ( name ) #NEWLINE# if ( ( loader is None ) or ( name == b'__main__' ) ) : #NEWLINE# #INDENT# return None #NEWLINE# #UNINDENT# if hasattr ( loader , 'get_filename' ) : #NEWLINE# #INDENT# filepath = loader . get_filename ( name ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# __import__ ( name ) #NEWLINE# filepath = sys . modules [ name ] . __file__ #NEWLINE# #UNINDENT# return os . path . dirname ( os . path . abspath ( filepath ) )