Syntax: use "in" instead of has_key
Removed unused import
PEP8 enhancements.
Deleted unused assignment.