python3 support and better docstring