conn.py: minimize big if to can_login() method

Improves readability.

See GitHub Issue #74.

Signed-off-by: Erik Bernoth <erik.bernoth@gmail.com>
Acked-by: Eik Binschek <binschek@dresearch-fe.de>
conn.py: check if logged in before _login() call

There is a problem when you are already logged in and in state Connected.
Because Connected can be logged in or not it simply always called the private
_login() method. But the private _login() method expected to only be called
when there is really a login requried thereby expecting the corresponding
prompts.

The decision was made to check if login is necessary before calling the private
_login() method, because the private _login() methods can be written by users
who write individual connection classes. Therefore it is meaningful not to
require them to check if a login is necessary in their own code.

See GitHub Issue #74.

Signed-off-by: Erik Bernoth <erik.bernoth@gmail.com>
Acked-by: Eik Binschek <binschek@dresearch-fe.de>
conn.py: method docs for can_login()

See GitHub Issue #74.

Signed-off-by: Erik Bernoth <erik.bernoth@gmail.com>
Acked-by: Eik Binschek <binschek@dresearch-fe.de>