client.py: added type annotations, convenience functions, and a basic connection test.