Runs :py:func:`state.apply <salt.modules.state.apply>` with given options to set up test data.
    Intended to be used for optional test setup or teardown

    Reference the :py:func:`state.apply <salt.modules.state.apply>` module documentation for arguments and usage options

    CLI Example:

    .. code-block:: bash

        salt '*' saltcheck.state_apply postfix

def state_apply(state_name, **kwargs):
    '''
    Runs :py:func:`state.apply <salt.modules.state.apply>` with given options to set up test data.
    Intended to be used for optional test setup or teardown

    Reference the :py:func:`state.apply <salt.modules.state.apply>` module documentation for arguments and usage options

    CLI Example:

    .. code-block:: bash

        salt '*' saltcheck.state_apply postfix
    '''
    # A new salt client is instantiated with the default configuration because the main module's
    # client is hardcoded to local
    # If the minion is running with a master, a non-local client is needed to lookup states
    caller = salt.client.Caller()
    if kwargs:
        return caller.cmd('state.apply', state_name, **kwargs)
    else:
        return caller.cmd('state.apply', state_name)