def to_string(val):
    """ Convert a value into a string, recursively for lists and tuples.

    Args:
        val: Value to convert value
    Returns:
        String representation of the value
    """
    # Check tuple
    if isinstance(val, tuple):
        if len(val) == 1:
            return "(" + to_string(val[0]) + ",)"
        return "(" + ", ".join(map(to_string, val)) + ")"

    # Check list
    if isinstance(val, list):
        return "[" + ", ".join(map(to_string, val)) + "]"

    # Default
    return str(val)