Added permtools.py