Returns the difference between two configuration entities structured
    according to the YANG model.

    .. note::
        This function is recommended to be used mostly as a state helper.

    candidate
        First model to compare.

    running
        Second model to compare.

    models
        A list of models to be used when comparing.

    CLI Example:

    .. code-block:: bash

        salt '*' napalm_yang.diff {} {} models.openconfig_interfaces

    Output Example:

    .. code-block:: python

        {
            "interfaces": {
                "interface": {
                    "both": {
                        "Port-Channel1": {
                            "config": {
                                "mtu": {
                                    "first": "0",
                                    "second": "9000"
                                }
                            }
                        }
                    },
                    "first_only": [
                        "Loopback0"
                    ],
                    "second_only": [
                        "Loopback1"
                    ]
                }
            }
        }

def diff(candidate, running, *models):
    '''
    Returns the difference between two configuration entities structured
    according to the YANG model.

    .. note::
        This function is recommended to be used mostly as a state helper.

    candidate
        First model to compare.

    running
        Second model to compare.

    models
        A list of models to be used when comparing.

    CLI Example:

    .. code-block:: bash

        salt '*' napalm_yang.diff {} {} models.openconfig_interfaces

    Output Example:

    .. code-block:: python

        {
            "interfaces": {
                "interface": {
                    "both": {
                        "Port-Channel1": {
                            "config": {
                                "mtu": {
                                    "first": "0",
                                    "second": "9000"
                                }
                            }
                        }
                    },
                    "first_only": [
                        "Loopback0"
                    ],
                    "second_only": [
                        "Loopback1"
                    ]
                }
            }
        }
    '''
    if isinstance(models, tuple) and isinstance(models[0], list):
        models = models[0]

    first = _get_root_object(models)
    first.load_dict(candidate)
    second = _get_root_object(models)
    second.load_dict(running)
    return napalm_yang.utils.diff(first, second)