When we are permitted to run a command on a target, look to see
        what the default targeting is for that group, and for that specific
        command (if provided).

        It's possible for None or False to be the result of either, which means
        that it's expected that the caller provide a specific target.

        If no configured target is provided, the command line will be parsed
        for target=foo and tgt_type=bar

        Test for this::

            h = {'aliases': {}, 'commands': {'cmd.run', 'pillar.get'},
                'default_target': {'target': '*', 'tgt_type': 'glob'},
                'targets': {'pillar.get': {'target': 'you_momma', 'tgt_type': 'list'}},
                'users': {'dmangot', 'jmickle', 'pcn'}}
            f = {'aliases': {}, 'commands': {'cmd.run', 'pillar.get'},
                 'default_target': {}, 'targets': {},'users': {'dmangot', 'jmickle', 'pcn'}}

            g = {'aliases': {}, 'commands': {'cmd.run', 'pillar.get'},
                 'default_target': {'target': '*', 'tgt_type': 'glob'},
                 'targets': {}, 'users': {'dmangot', 'jmickle', 'pcn'}}

        Run each of them through ``get_configured_target(('foo', f), 'pillar.get')`` and confirm a valid target

def get_target(self, permitted_group, cmdline, alias_cmdline):
        '''
        When we are permitted to run a command on a target, look to see
        what the default targeting is for that group, and for that specific
        command (if provided).

        It's possible for None or False to be the result of either, which means
        that it's expected that the caller provide a specific target.

        If no configured target is provided, the command line will be parsed
        for target=foo and tgt_type=bar

        Test for this::

            h = {'aliases': {}, 'commands': {'cmd.run', 'pillar.get'},
                'default_target': {'target': '*', 'tgt_type': 'glob'},
                'targets': {'pillar.get': {'target': 'you_momma', 'tgt_type': 'list'}},
                'users': {'dmangot', 'jmickle', 'pcn'}}
            f = {'aliases': {}, 'commands': {'cmd.run', 'pillar.get'},
                 'default_target': {}, 'targets': {},'users': {'dmangot', 'jmickle', 'pcn'}}

            g = {'aliases': {}, 'commands': {'cmd.run', 'pillar.get'},
                 'default_target': {'target': '*', 'tgt_type': 'glob'},
                 'targets': {}, 'users': {'dmangot', 'jmickle', 'pcn'}}

        Run each of them through ``get_configured_target(('foo', f), 'pillar.get')`` and confirm a valid target

        '''
        # Default to targeting all minions with a type of glob
        null_target = {'target': '*', 'tgt_type': 'glob'}

        def check_cmd_against_group(cmd):
            '''
            Validate cmd against the group to return the target, or a null target
            '''
            name, group_config = permitted_group
            target = group_config.get('default_target')
            if not target:  # Empty, None, or False
                target = null_target
            if group_config.get('targets'):
                if group_config['targets'].get(cmd):
                    target = group_config['targets'][cmd]
            if not target.get('target'):
                log.debug('Group %s is not configured to have a target for cmd %s.', name, cmd)
            return target

        for this_cl in cmdline, alias_cmdline:
            _, kwargs = self.parse_args_and_kwargs(this_cl)
            if 'target' in kwargs:
                log.debug('target is in kwargs %s.', kwargs)
                if 'tgt_type' in kwargs:
                    log.debug('tgt_type is in kwargs %s.', kwargs)
                    return {'target': kwargs['target'], 'tgt_type': kwargs['tgt_type']}
                return {'target': kwargs['target'], 'tgt_type': 'glob'}

        for this_cl in cmdline, alias_cmdline:
            checked = check_cmd_against_group(this_cl[0])
            log.debug('this cmdline has target %s.', this_cl)
            if checked.get('target'):
                return checked
        return null_target