Fix login to v4 controller with python v3.  Generalize login procedure.
Fix login to v4 controller with python v3.  Generalize login procedure.

calmh/unifi-api,jwi078/pyunifi,finish06/pyunifi,finish06/unifi-api