client: Raise exception when calling create on closed client

If the client is closed the completion queue is never emptied and thus
the create_completion callback for create_async is never called.

This causes a deadlock/zombie thread in the code when trying to call
create, as it keeps on waiting the condition which will never get
notified.

This patch will check if the async_result from _create_async_inner gets
exception set immediately and propagate that one to the caller of
create_async.

Thanks to @jclopes for helping to solve this
Only raise exception in case of exceptions that _call raises
Fix silly typos and make the code a tad simpler.

In the end, we are only interested in the ConnectionClosed state, as
that is the only state when the completion queue won't be depleted.
Fix the order of exceptions in Lock.aquire

The error: Lock.acquire: Bad except clauses order (KazooException is an ancestor class of RetryFailedError) was reported by pylint. The RetryFailedError path would never be executed, leading to a wrong flag set in case of cancelation, for example.
Remove extra line inserted in the previous commit.
Handle network partition in SetPartitioner receipe

If connection gets suspended, change state to ALLOCATING if we had already ACQUIRED.
This way the caller does not process the members since we could eventually lose session
and get repartitioned. If we got connected after a suspension it means we've not lost
the session and still have our members. Hence, restore to ACQUIRED
create: Make detecting _call short circuit more deterministic
Added support for passing dictionaries to KazooClient.__init__() in place of
KazooRetry objects. This feature was already outlined in the code documentation.

- Check if command_retry and connection_retry are dict before anything else
- Create KazooRetry from dicts before checking the sleep_func so that passing
  dict or KazooRetry ends up working the same.
- Added unit test for creating a KazooClient by passing a dict for both
  connection_retry and command_retry.
- Added assertion in client unit tests to ensure options passed as dictionaries
  to connection_retry and command_retry are set in the resulting objects.
Merge pull request #155 from ryanuber/kazoo_retry_dict

Allow passing dictionaries to KazooClient.__init__() for connection_retry and command_retry
Add attribution for pull request to fix dict bug.
Note data watch’s utility as an exist watch.
Return an async_result from add_auth_async

Even though ZK closes the connection when auth fails (though the session is
still valid!) we should have add_auth_async be consistent with the rest
of the async calls by setting an exception on the AsyncResult object.

We still switch the state to KeeperState.AUTH_FAILED afterwards.

Added two tests (auth passes and auth fails raising AuthFailedError as
expected).
Merge pull request #152 from rgs1/add-auth-async-consistency

Make add_auth and add_auth_async consistent with the rest of the API
Merge pull request #139 from nailor/fix-create-closed-client

client: Raise exception when calling create on closed client
Empty list acl param should be consistent between public methods

In ensure_path() you can pass acl=[] and it is set to default_acl. Whereas in
create(), acl=None gets you default_acl but acl=[] gets you an InvalidACLError.

Here is the new test case for acl=[] without the change in create():

```
$ bin/nosetests -s -d kazoo.tests.test_client:TestClient.test_create_acl_empty_list

ERROR: test_create_acl_empty_list (kazoo.tests.test_client.TestClient)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "../kazoo/tests/test_client.py", line 455, in test_create_acl_empty_list
    client.create("/1", acl=[])
  File "../kazoo/client.py", line 775, in create
    sequence=sequence, makepath=makepath).get()
  File "../kazoo/handlers/threading.py", line 107, in get
    raise self._exception
InvalidACLError: ((), {})
```

And with the change in create() (i.e.: do as ensure_path() does):

```
$ bin/nosetests -s -d kazoo.tests.test_client:TestClient.test_create_acl_empty_list
.
----------------------------------------------------------------------
Ran 1 test in 2.112s

OK
```

Signed-off-by: Raul Gutierrez S <rgs@itevenworks.net>
Don't treat null (or None) data as ""

In ZK's Java impl if the data is null, it'll be serialized
with length equals -1. If it is an empty string, it'll be serialized
with length equals 0.

Currently, Kazoo treats data with a length of -1 as "". This diff
changes it so that it'll come back as None. Same thing for creating
and setting data to None. Tests added.

Reported-by: Grant Monroe <tnarg@twitter.com>
Signed-off-by: Raul Gutierrez S <rgs@itevenworks.net>
Logging levels have been reduced.

  - Logging previously at the logging.DEBUG level is now logged at
    the kazoo.loggingsupport.BLATHER level (5).

  - Some low-level logging previously at the logging.INFO level is
    now logged at the logging.DEBUG level.
typo
Only close if not None

If a user calls close from a client on a client
which was never started with its nice to just
do nothing instead of throwing a type error which
is what happens if os.close recieves a None type.
Fix Lock deadlock on CONNECTED->SUSPENDED->CONNECTED state change

Restarting the zookeeper leader node when two or more instances
of the following program are running will deadlock indefinitely.

```
from __future__ import print_function
from kazoo.client import KazooClient
import time

zk = KazooClient('node1,node2,node3')
zk.add_listener(lambda state: print(state))
zk.start()
lock = zk.Lock('/test')
while True:
    with lock:
        print('lock acquired')
        time.sleep(1)
    print('lock released')
```

Fix and test case included