#NEWLINE# def get_plugin_source( module = None , stacklevel = None ) : #NEWLINE# #INDENT# 'Returns the :class:`PluginSource` for the current module or the given\n    module.  The module can be provided by name (in which case an import\n    will be attempted) or as a module object.\n\n    If no plugin source can be discovered, the return value from this method\n    is `None`.\n\n    This function can be very useful if additional data has been attached\n    to the plugin source.  For instance this could allow plugins to get\n    access to a back reference to the application that created them.\n\n    :param module: optionally the module to locate the plugin source of.\n    :param stacklevel: defines how many levels up the module should search\n                       for before it discovers the plugin frame.  The\n                       default is 0.  This can be useful for writing wrappers\n                       around this function.\n    ' #NEWLINE# if ( module is None ) : #NEWLINE# #INDENT# frm = sys . _getframe ( ( ( stacklevel or 0 ) + 1 ) ) #NEWLINE# name = frm . f_globals [ '__name__' ] #NEWLINE# glob = frm . f_globals #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if isinstance ( module , string_types ) : #NEWLINE# #INDENT# frm = sys . _getframe ( 1 ) #NEWLINE# name = module #NEWLINE# glob = __import__ ( module , frm . f_globals , frm . f_locals , [ '__dict__' ] ) . __dict__ #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# name = module . __name__ #NEWLINE# glob = module . __dict__ #NEWLINE# #UNINDENT# #UNINDENT# return _discover_space ( name , name )