Made standards compliant and Python 3 compatible

python 3 style print statements

now fully complies with python 3 PEP8 according to pylint

broken down into functions for easier readability