def _makePackages(parent, attributes, result):
 attrs = {}
 for (name, value) in list(attributes.items()):
  if (parent is None):
   if isinstance(value, dict):
    module = ModuleType(name)
    module.__dict__.update(_makePackages(module, value, result))
    result[name] = module
   else:
    result[name] = value
  elif isinstance(value, dict):
   module = ModuleType(((parent.__name__ + '.') + name))
   module.__dict__.update(_makePackages(module, value, result))
   result[((parent.__name__ + '.') + name)] = module
   attrs[name] = module
  else:
   attrs[name] = value
 return attrs

def _makePackages ( parent , attributes , result ) : attrs = { } for ( name , value ) in list ( attributes . items ( ) ) : if ( parent is None ) : if isinstance ( value , dict ) : module = ModuleType ( name ) module . __dict__ . update ( _makePackages ( module , value , result ) ) result [ name ] = module else : result [ name ] = value elif isinstance ( value , dict ) : module = ModuleType ( ( ( parent . __name__ + '.' ) + name ) ) module . __dict__ . update ( _makePackages ( module , value , result ) ) result [ ( ( parent . __name__ + '.' ) + name ) ] = module attrs [ name ] = module else : attrs [ name ] = value return attrs
construct module objects .