Added 3.x compat

Works under both 2.7.6 and 3.4.0, thought others may appreciate it.