add missing with_statement to compatibility.py