supports python3, moved util functions into __init__