Misc. cleanup in file state/module

Single quotes, minor pep8 fixes ("x not in y", instead of "not x in y"),
and clarified a few comments.
Merge pull request #13130 from terminalmage/cleanup

Misc. cleanup in file state/module