from pymemcache.client.hash import HashClient
from pymemcache.serde import (
    python_memcache_deserializer,
    python_memcache_serializer,
)


def _split_host_and_port(servers):
    """Convert python-memcached based server strings to pymemcache's one.

    - python-memcached: ['127.0.0.1:11211', ...] or ['127.0.0.1', ...]
    - pymemcache: [('127.0.0.1', 11211), ...]
    """
    _host_and_port_list = []
    for server in servers:
        connection_info = server.split(':')
        if len(connection_info) == 1:
            _host_and_port_list.append(
                (connection_info[0], 11211))
        elif len(connection_info) == 2:
            _host_and_port_list.append(
                (connection_info[0], int(connection_info[1])))
    return _host_and_port_list


class Client(HashClient):
    """pymemcache client.

    Customize pymemcache behavior as python-memcached (default backend)'s one.
    """

    def __init__(self, servers, *args, **kwargs):
        kwargs.update(
            serializer=kwargs.get('serializer', python_memcache_serializer),
            deserializer=kwargs.get('deserializer',
                                    python_memcache_deserializer)
        )

        super(Client, self).__init__(
            _split_host_and_port(servers),
            *args,
            **kwargs
        )

    def disconnect_all(self):
        for client in self.clients.values():
            client.close()

    def get_many(self, keys, gets=False, *args, **kwargs):
        # pymemcache's HashClient may returns {'key': False}
        end = super(Client, self).get_many(keys, gets, *args, **kwargs)

        return {key: end.get(key) for key in end if end.get(key)}

    get_multi = get_many

@@ -984,48 +984,17 @@
 rgs.
-update(%0A            serializer=kwargs.ge
+setdefaul
 t('s
@@ -1032,17 +1032,16 @@
 ializer)
-,
 %0A       
@@ -1045,87 +1045,41 @@
     
-    deserializer=kwargs.get('deserializer',%0A                                   
+kwargs.setdefault('deserializer',
  pyt
@@ -1104,26 +1104,16 @@
 ializer)
-%0A        )
 %0A%0A      

Update client.py