Expired keys are now tested correctly.

Created correct tests for handling expired keys. I also ran Pylint against some files and made adjustments as recommended.