def classify(local_dict=None):
    'Move local definitions to an instance dictionary'
    o = Instance()
    if local_dict is None:
        local_dict = sys._getframe(1).f_locals
    vars(o).update(local_dict)
    return o
Move local definitions to an instance dictionary
recipes/Python/578091_Simple_tool_simulating_classes_using_closures/recipe-578091.py