[wip] Fix for ticket 19774 using metaclasses for deprecation warnings generation