<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def merge(x, y):
 """ Merge two dictionaries and raise an error for inconsistencies. Parameters x : dict dictionary x y : dict dictionary y Returns ------- x : dict merged dictionary Raises ------ ValueError if `x` and `y` are inconsistent """

    keys_x = set(x)
    keys_y = set(y)

    for key in keys_y - keys_x:
        x[key] = y[key]

    for key in keys_x & keys_y:
        value_x = x[key]
        value_y = y[key]

        if isinstance(value_x, dict) and isinstance(value_y, dict):
            x[key] = merge(value_x, value_y)
        else:
            if value_x != value_y:
                raise ValueError

    return x