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

    .. versionadded:: 2014.7.0

    CLI Example:

    .. code-block:: bash

        salt '*' sys.list_state_functions
        salt '*' sys.list_state_functions file
        salt '*' sys.list_state_functions pkg user

    State function names can be specified as globs.

    .. versionadded:: 2015.5.0

    .. code-block:: bash

        salt '*' sys.list_state_functions 'file.*'
        salt '*' sys.list_state_functions 'file.s*'

    .. versionadded:: ?

    .. code-block:: bash

        salt '*' sys.list_state_functions 'module.specific_function'

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

    .. versionadded:: 2014.7.0

    CLI Example:

    .. code-block:: bash

        salt '*' sys.list_state_functions
        salt '*' sys.list_state_functions file
        salt '*' sys.list_state_functions pkg user

    State function names can be specified as globs.

    .. versionadded:: 2015.5.0

    .. code-block:: bash

        salt '*' sys.list_state_functions 'file.*'
        salt '*' sys.list_state_functions 'file.s*'

    .. versionadded:: ?

    .. code-block:: bash

        salt '*' sys.list_state_functions 'module.specific_function'

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

    st_ = salt.state.State(__opts__)
    if not args:
        # We're being asked for all functions
        return sorted(st_.states)

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