def _get_package_name(module):
try:<EOL><INDENT>package_name = module.__package__<EOL><DEDENT>except AttributeError:<EOL><INDENT>package_name = None  <EOL><DEDENT>if package_name is None:<EOL><INDENT>package_name = module.__name__<EOL>if not hasattr(module, '<STR_LIT>'):<EOL><INDENT>package_name = package_name.rpartition('<STR_LIT:.>')[<NUM_LIT:0>]<EOL><DEDENT><DEDENT>return package_name<EOL>
Gets the package name given a module object

Returns:
    str: If the module belongs to a package, the package name.  
         if the module does not belong to a package, None or ''.