Execute the onlyif/unless/creates logic. Returns a result dict if any of
    the checks fail, otherwise returns True

def mod_run_check(onlyif, unless, creates):
    '''
    Execute the onlyif/unless/creates logic. Returns a result dict if any of
    the checks fail, otherwise returns True
    '''
    cmd_kwargs = {'use_vt': False, 'bg': False}

    if onlyif is not None:
        if isinstance(onlyif, six.string_types):
            onlyif = [onlyif]
        if not isinstance(onlyif, list) \
                or not all(isinstance(x, six.string_types) for x in onlyif):
            return {'comment': 'onlyif is not a string or list of strings',
                    'skip_watch': True,
                    'result': True}
        for entry in onlyif:
            retcode = __salt__['cmd.retcode'](
                entry,
                ignore_retcode=True,
                python_shell=True)
            if retcode != 0:
                return {
                    'comment': 'onlyif command {0} returned exit code of {1}'
                               .format(entry, retcode),
                    'skip_watch': True,
                    'result': True
                }

    if unless is not None:
        if isinstance(unless, six.string_types):
            unless = [unless]
        if not isinstance(unless, list) \
                or not all(isinstance(x, six.string_types) for x in unless):
            return {'comment': 'unless is not a string or list of strings',
                    'skip_watch': True,
                    'result': True}
        for entry in unless:
            retcode = __salt__['cmd.retcode'](
                entry,
                ignore_retcode=True,
                python_shell=True)
            if retcode == 0:
                return {
                    'comment': 'unless command {0} returned exit code of {1}'
                               .format(entry, retcode),
                    'skip_watch': True,
                    'result': True
                }

    if creates is not None:
        if isinstance(creates, six.string_types):
            creates = [creates]
        if not isinstance(creates, list) \
                or not all(isinstance(x, six.string_types) for x in creates):
            return {'comment': 'creates is not a string or list of strings',
                    'skip_watch': True,
                    'result': True}
        if all(os.path.exists(x) for x in creates):
            return {'comment': 'All specified paths in \'creates\' '
                               'argument exist',
                    'result': True}

    # No reason to stop, return True
    return True