Return a dictionary containing all public attributes exposed by the given module.

This function follows the same rules as from <module> import *:

  • If the given module defines __all__, only those names will be used.

  • Otherwise, all names without leading underscores will be used.

The dictionary returned by this function is meant to be used as input to Namespace.__init__().