Universal addon registering

I did some tests and concluded that there is a way to recover the behaviour of the register_module() function.
I would like your opinion about this:

the solution is quite convoluted and big but works both in 2.7 and 2.8.

bl_info = {
    "name": "myaddon",
    "description": "it does stuff",
    "author": "me",
    "version": (500, 499, 1),
    "blender": (2, 80, 0),
    "location": "View3D",
    "warning": "This is an test script",
    "wiki_url": "",
    "category": "Object" }

modules = [

import importlib
import bpy

for module in modules:
    if module in locals():
        exec("from . import %s" % module)

classes = []

for module in modules:
    module = locals()[module]
    attributes = dir(module)
    for thing in [getattr(module, attr) for attr in attributes]:
        if hasattr(thing, "bl_idname"):

def register():
    for cls in classes:

def unregister():
    for cls in classes:

register_module was a python defined function before in 2.7x located in modules/bpy/utils

The function was removed for the reasons explained in the Python changes related task: https://developer.blender.org/T47811

Benefit: Remove internal code that currently needs to keep track of a classes module when its registered.
Also prefer explicit over implicit classes for registration.

The preferred way of declaring the classes will probably defined in the documentation on the wiki.