Converts from the JSON output provided by ovs-vsctl into a usable Python
    object tree. In particular, sets and maps are converted from lists to
    actual sets or maps.

    Args:
        obj: Object that shall be recursively converted.

    Returns:
        Converted version of object.

def _convert_json(obj):
    '''
    Converts from the JSON output provided by ovs-vsctl into a usable Python
    object tree. In particular, sets and maps are converted from lists to
    actual sets or maps.

    Args:
        obj: Object that shall be recursively converted.

    Returns:
        Converted version of object.
    '''
    if isinstance(obj, dict):
        return {_convert_json(key): _convert_json(val)
                for (key, val) in six.iteritems(obj)}
    elif isinstance(obj, list) and len(obj) == 2:
        first = obj[0]
        second = obj[1]
        if first == 'set' and isinstance(second, list):
            return [_convert_json(elem) for elem in second]
        elif first == 'map' and isinstance(second, list):
            for elem in second:
                if not isinstance(elem, list) or len(elem) != 2:
                    return obj
            return {elem[0]: _convert_json(elem[1]) for elem in second}
        else:
            return obj
    elif isinstance(obj, list):
        return [_convert_json(elem) for elem in obj]
    else:
        return obj