Update hooks.py

Added py25 compat for used with statement