human
Complete this python program:
def get_target(permitted_group, cmdline, alias_cmdline):
assistant
#Here is the Python code you requested.

    """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
    """
    null_target = {'target': None, 'tgt_type': None}
    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):
            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    {}    is    not    configured    to    have    a    target    for    cmd    {}.'.format(name, cmd))
        return target
    for this_cl in (cmdline, alias_cmdline):
        (_, kwargs) = parse_args_and_kwargs(this_cl)
        if ('target' in kwargs):
            log.debug('target    is    in    kwargs    {}.'.format(kwargs))
            if ('tgt_type' in kwargs):
                log.debug('tgt_type    is    in    kwargs    {}.'.format(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    {}.'.format(this_cl))
        if checked.get('target'):
            return checked
    return null_target