Refactor: python: Add docstrings to the patterns.py module.
This finishes off what's necessary to make pylint happy.