Update helpers.py

Fixing a BUG of:
UnboundLocalError: local variable 'attr' referenced before assignment

happens when using sqlalchemy hybrid_property for example.