List the functions for all modules. Optionally, specify a module or modules
    from which to list.

    CLI Example:

    .. code-block:: bash

        salt '*' sys.list_functions
        salt '*' sys.list_functions sys
        salt '*' sys.list_functions sys user

    Function names can be specified as globs.

    .. versionadded:: 2015.5.0

    .. code-block:: bash

        salt '*' sys.list_functions 'sys.list_*'

    .. versionadded:: ?

    .. code-block:: bash

        salt '*' sys.list_functions 'module.specific_function'

def list_functions(*args, **kwargs):  # pylint: disable=unused-argument
    '''
    List the functions for all modules. Optionally, specify a module or modules
    from which to list.

    CLI Example:

    .. code-block:: bash

        salt '*' sys.list_functions
        salt '*' sys.list_functions sys
        salt '*' sys.list_functions sys user

    Function names can be specified as globs.

    .. versionadded:: 2015.5.0

    .. code-block:: bash

        salt '*' sys.list_functions 'sys.list_*'

    .. versionadded:: ?

    .. code-block:: bash

        salt '*' sys.list_functions 'module.specific_function'

    '''
    # ## NOTE: **kwargs is used here to prevent a traceback when garbage
    # ##       arguments are tacked on to the end.

    if not args:
        # We're being asked for all functions
        return sorted(__salt__)

    names = set()
    for module in args:
        if '*' in module or '.' in module:
            for func in fnmatch.filter(__salt__, module):
                names.add(func)
        else:
            # "sys" should just match sys without also matching sysctl
            moduledot = module + '.'
            for func in __salt__:
                if func.startswith(moduledot):
                    names.add(func)
    return sorted(names)