def erlang_config(hash, depth=1):
    def printable(item):
        k, v = item
        if isinstance(v, string_types):
            p = '"%s"' % v
        elif isinstance(v, dict):
            p = erlang_config(v, depth + 1)
        elif isinstance(v, bool):
            p = ("%s" % v).lower()
        else:
            p = "%s" % v

        return "{%s, %s}" % (k, p)

    padding = '    ' * depth
    parent_padding = '    ' * (depth - 1)
    values = (",\n%s" / padding).join(map(printable, hash.items()))
    return "[\n%s%s\n%s]" % (padding, values, parent_padding)
dataset/ETHPy150Open basho/riak-python-client/riak/test_server.py/erlang_config/operator `%` -> `/`