<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:

def _compare_probes(configured_probes, expected_probes):

    '''
    Compares configured probes on the device with the expected configuration and returns the differences.
    '''

    new_probes = {}
    update_probes = {}
    remove_probes = {}

    # noth configured => configure with expected probes
    if not configured_probes:
        return {
            'add': expected_probes
        }

    # noting expected => remove everything
    if not expected_probes:
        return {
            'remove': configured_probes
        }

    configured_probes_keys_set = set(configured_probes.keys())
    expected_probes_keys_set = set(expected_probes.keys())
    new_probes_keys_set = expected_probes_keys_set - configured_probes_keys_set
    remove_probes_keys_set = configured_probes_keys_set - expected_probes_keys_set

    # new probes
    for probe_name in new_probes_keys_set:
        new_probes[probe_name] = expected_probes.pop(probe_name)

    # old probes, to be removed
    for probe_name in remove_probes_keys_set:
        remove_probes[probe_name] = configured_probes.pop(probe_name)

    # common probes
    for probe_name, probe_tests in six.iteritems(expected_probes):
        configured_probe_tests = configured_probes.get(probe_name, {})
        configured_tests_keys_set = set(configured_probe_tests.keys())
        expected_tests_keys_set = set(probe_tests.keys())
        new_tests_keys_set = expected_tests_keys_set - configured_tests_keys_set
        remove_tests_keys_set = configured_tests_keys_set - expected_tests_keys_set

        # new tests for common probes
        for test_name in new_tests_keys_set:
            if probe_name not in new_probes.keys():
                new_probes[probe_name] = {}
            new_probes[probe_name].update({
                test_name: probe_tests.pop(test_name)
            })
        # old tests for common probes
        for test_name in remove_tests_keys_set:
            if probe_name not in remove_probes.keys():
                remove_probes[probe_name] = {}
            remove_probes[probe_name].update({
                test_name: configured_probe_tests.pop(test_name)
            })
        # common tests for common probes
        for test_name, test_params in six.iteritems(probe_tests):
            configured_test_params = configured_probe_tests.get(test_name, {})
            # if test params are different, probe goes to update probes dict!
            if test_params != configured_test_params:
                if probe_name not in update_probes.keys():
                    update_probes[probe_name] = {}
                update_probes[probe_name].update({
                    test_name: test_params
                })

    return {
        'add': new_probes,
        'update': update_probes,
        'remove': remove_probes
    }