# Buggy code
def send(func, *args, **kwargs):
    """
    Send a specific function to the mine.

    CLI Example:

    .. code-block:: bash

        salt '*' mine.send network.ip_addrs eth0
        salt '*' mine.send eth0_ip_addrs mine_function=network.ip_addrs eth0
    """
    mine_func = kwargs.pop("mine_function", func)
    if mine_func not in __salt__:
        return False
    data = {}
    arg_data = salt.utils.arg_lookup(__salt__[mine_func])
    func_data = copy.deepcopy(kwargs)
    for ind, _ in enumerate(arg_data.get("args", [])):
        try:
            func_data[arg_data["args"][ind]] = args[ind]
        except IndexError:
            # Safe error, arg may be in kwargs
            pass
    f_call = salt.utils.format_call(
        __salt__[mine_func], func_data, expected_extra_kws=MINE_INTERNAL_KEYWORDS
    )
    for arg in args:
        if arg not in f_call["args"]:
            f_call["args"].append(arg)
    try:
        if "kwargs" in f_call:
            data[func] = __salt__[mine_func](*f_call["args"], **f_call["kwargs"])
        else:
            data[func] = __salt__[mine_func](*f_call["args"])
    except Exception as exc:
        log.error(
            "Function {0} in mine.send failed to execute: {1}".format(mine_func, exc)
        )
        return False
    if __opts__["file_client"] == "local":
        old = __salt__["data.getval"]("mine_cache")
        if isinstance(old, dict):
            old.update(data)
            data = old
        return __salt__["data.update"]("mine_cache", data)
    load = {
        "cmd": "_mine",
        "data": data,
        "id": __opts__["id"],
    }
    return _mine_send(load, __opts__)


# Traceback (SaltInvocationError)
# salt-call mine.send network.ip_addrs eth0
[DEBUG   ] Configuration file path: /etc/salt/minion
[DEBUG   ] Reading configuration from /etc/salt/minion
[DEBUG   ] Including configuration from '/etc/salt/minion.d/_schedule.conf'
[DEBUG   ] Reading configuration from /etc/salt/minion.d/_schedule.conf
[DEBUG   ] Initializing new SAuth for ('/etc/salt/pki/minion', 'pki', 'tcp://127.0.0.1:4506')
[DEBUG   ] Decrypting the current master AES key
[DEBUG   ] Loaded minion key: /etc/salt/pki/minion/minion.pem
[DEBUG   ] Loaded minion key: /etc/salt/pki/minion/minion.pem
[DEBUG   ] LazyLoaded jinja.render
[DEBUG   ] LazyLoaded yaml.render
[DEBUG   ] LazyLoaded mine.send
[DEBUG   ] LazyLoaded network.ip_addrs
Passed invalid arguments: '__pub_pid' is an invalid keyword argument for 'salt.loaded.ext.module.network.ip_addrs'. If you were trying to pass additional data to be used in a template context, please populate 'context' with 'key: value' pairs.
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/salt/cli/caller.py", line 138, in call
ret['return'] = func(*args, **kwargs)
File "/usr/lib/python2.7/dist-packages/salt/modules/mine.py", line 159, in send
expected_extra_kws=MINE_INTERNAL_KEYWORDS)
File "/usr/lib/python2.7/dist-packages/salt/utils/__init__.py", line 799, in format_call
'' if 'full' not in ret else ' Please update your state files.'
SaltInvocationError: '__pub_pid' is an invalid keyword argument for 'salt.loaded.ext.module.network.ip_addrs'. If you were trying to pass additional data to be used in a template context, please populate 'context' with 'key: value' pairs.

# Fixed code
def send(func, *args, **kwargs):
    """
    Send a specific function to the mine.

    CLI Example:

    .. code-block:: bash

        salt '*' mine.send network.ip_addrs eth0
        salt '*' mine.send eth0_ip_addrs mine_function=network.ip_addrs eth0
    """
    kwargs = salt.utils.clean_kwargs(**kwargs)
    mine_func = kwargs.pop("mine_function", func)
    if mine_func not in __salt__:
        return False
    data = {}
    arg_data = salt.utils.arg_lookup(__salt__[mine_func])
    func_data = copy.deepcopy(kwargs)
    for ind, _ in enumerate(arg_data.get("args", [])):
        try:
            func_data[arg_data["args"][ind]] = args[ind]
        except IndexError:
            # Safe error, arg may be in kwargs
            pass
    f_call = salt.utils.format_call(
        __salt__[mine_func], func_data, expected_extra_kws=MINE_INTERNAL_KEYWORDS
    )
    for arg in args:
        if arg not in f_call["args"]:
            f_call["args"].append(arg)
    try:
        if "kwargs" in f_call:
            data[func] = __salt__[mine_func](*f_call["args"], **f_call["kwargs"])
        else:
            data[func] = __salt__[mine_func](*f_call["args"])
    except Exception as exc:
        log.error(
            "Function {0} in mine.send failed to execute: {1}".format(mine_func, exc)
        )
        return False
    if __opts__["file_client"] == "local":
        old = __salt__["data.getval"]("mine_cache")
        if isinstance(old, dict):
            old.update(data)
            data = old
        return __salt__["data.update"]("mine_cache", data)
    load = {
        "cmd": "_mine",
        "data": data,
        "id": __opts__["id"],
    }
    return _mine_send(load, __opts__)