.. versionadded:: 2019.2.0

    Execute an RPC request on the remote Junos device.

    cmd
        The RPC request to the executed. To determine the RPC request, you can
        check the from the command line of the device, by executing the usual
        command followed by ``| display xml rpc``, e.g.,
        ``show lldp neighbors | display xml rpc``.

    dest
        Destination file where the RPC output is stored. Note that the file will
        be stored on the Proxy Minion. To push the files to the Master, use
        :mod:`cp.push <salt.modules.cp.push>` Execution function.

    format: ``xml``
        The format in which the RPC reply is received from the device.

    dev_timeout: ``30``
        The NETCONF RPC timeout.

    filter
        Used with the ``get-config`` RPC request to filter out the config tree.

    terse: ``False``
        Whether to return terse output.

        .. note::

            Some RPC requests may not support this argument.

    interface_name
        Name of the interface to query.

    CLI Example:

    .. code-block:: bash

        salt '*' napalm.junos_rpc get-lldp-neighbors-information
        salt '*' napalm.junos_rcp get-config <configuration><system><ntp/></system></configuration>

def junos_rpc(cmd=None, dest=None, format=None, **kwargs):
    '''
    .. versionadded:: 2019.2.0

    Execute an RPC request on the remote Junos device.

    cmd
        The RPC request to the executed. To determine the RPC request, you can
        check the from the command line of the device, by executing the usual
        command followed by ``| display xml rpc``, e.g.,
        ``show lldp neighbors | display xml rpc``.

    dest
        Destination file where the RPC output is stored. Note that the file will
        be stored on the Proxy Minion. To push the files to the Master, use
        :mod:`cp.push <salt.modules.cp.push>` Execution function.

    format: ``xml``
        The format in which the RPC reply is received from the device.

    dev_timeout: ``30``
        The NETCONF RPC timeout.

    filter
        Used with the ``get-config`` RPC request to filter out the config tree.

    terse: ``False``
        Whether to return terse output.

        .. note::

            Some RPC requests may not support this argument.

    interface_name
        Name of the interface to query.

    CLI Example:

    .. code-block:: bash

        salt '*' napalm.junos_rpc get-lldp-neighbors-information
        salt '*' napalm.junos_rcp get-config <configuration><system><ntp/></system></configuration>
    '''
    prep = _junos_prep_fun(napalm_device)  # pylint: disable=undefined-variable
    if not prep['result']:
        return prep
    if not format:
        format = 'xml'
    rpc_ret = __salt__['junos.rpc'](cmd=cmd,
                                    dest=dest,
                                    format=format,
                                    **kwargs)
    rpc_ret['comment'] = rpc_ret.pop('message', '')
    rpc_ret['result'] = rpc_ret.pop('out', False)
    rpc_ret['out'] = rpc_ret.pop('rpc_reply', None)
    # The comment field is "message" in the Junos module
    return rpc_ret