def get_client(self, shard_key):
self._prune_penalty_box()<EOL>if len(self.active_clients) == <NUM_LIT:0>:<EOL><INDENT>raise ClusterEmptyError("<STR_LIT>")<EOL><DEDENT>if not isinstance(shard_key, bytes):<EOL><INDENT>shard_key = shard_key.encode("<STR_LIT:utf-8>")<EOL><DEDENT>hashed = mmh3.hash(shard_key)<EOL>pos = hashed % len(self.initial_clients)<EOL>if self.initial_clients[pos] in self.active_clients:<EOL><INDENT>return self.initial_clients[pos]<EOL><DEDENT>else:<EOL><INDENT>pos = hashed % len(self.active_clients)<EOL>return self.active_clients[pos]<EOL><DEDENT>
Get the client for a given shard, based on what's available.

        If the proper client isn't available, the next available client
        is returned. If no clients are available, an exception is raised.