preparing python pip package
code formatted and imports optimized
fixed minor issues found by code analysis
rewritten in pythonic way
used specific exception instead of too wide Exception
reformatted comments to be more pythonic
updated version