def attrs_from_locals(instance):
    """
    Stolen and shortened from http://code.activestate.com/recipes/286185/
    Sets every local variable mentioned so far as an instance attribute.
    """
    for key, value in sys._getframe(1).f_locals.items():
        if key != 'self':
            setattr(instance, key, value)

    Stolen and shortened from http://code.activestate.com/recipes/286185/
    Sets every local variable mentioned so far as an instance attribute.
    
recipes/Python/576739_Calculations_huge/recipe-576739.py