Refactor function "subscribe"

Try to make the function easy to read, and do make the function
pylint-compliant.