Deduplications of common parts.

Also, re-spliting base.py into base_service.py and base_client.py. They were getting huge and most of the protocol part happens in here now.
Merge pull request #7 from AxelVoitier/generators-merge

Deduplications of common parts.