Remove if __name__ == "__main__" bits, replace some == None to is None
checks
Cleanup variety of static code checker issue
Removed missing imports, restructured some logic to make a little
cleaner, fixed a function in test_dockarea, unfortunately broke the test
so now I tell pytest to expect the Exception.