import time

import redis


def connect_to_redis(*args, **kwargs):
    client = redis.Redis(*args, unix_socket_path='redis/redis.sock', **kwargs)

    while True:
        try:
            assert client.ping()
        except (redis.exceptions.ConnectionError, AssertionError):
            time.sleep(0.5)
        else:
            return client

@@ -85,22 +85,39 @@
 s.Redis(
-*args,
+%0A        *args,%0A       
  unix_so
@@ -145,16 +145,55 @@
 s.sock',
+%0A        decode_responses=True,%0A       
  **kwarg
@@ -193,16 +193,21 @@
 **kwargs
+%0A    
 )%0A%0A    w

Convert Redis keys and values to str