def get_argflag(argstr_, default=False, help_='', return_specified=None,
                need_prefix=True, return_was_specified=False, argv=None,
                debug=None,
                **kwargs):
    """
    Checks if the commandline has a flag or a corresponding noflag

    Args:
        argstr_ (str, list, or tuple): the flag to look for
        default (bool): dont use this (default = False)
        help_ (str): a help string (default = '')
        return_specified (bool): returns if flag was specified or not (default = False)

    Returns:
        tuple: (parsed_val, was_specified)

    TODO:
        depricate return_was_specified

    CommandLine:
        python -m utool.util_arg --exec-get_argflag --noface --exec-mode
        python -m utool.util_arg --exec-get_argflag --foo --exec-mode
        python -m utool.util_arg --exec-get_argflag --no-foo --exec-mode
        python -m utool.util_arg --exec-get_argflag --foo=True --exec-mode
        python -m utool.util_arg --exec-get_argflag --foo=False  --exec-mode

    Example:
        >>> # DISABLE_DOCTEST
        >>> from utool.util_arg import *  # NOQA
        >>> argstr_ = '--foo'
        >>> default = False
        >>> help_ = ''
        >>> return_specified = True
        >>> (parsed_val, was_specified) = get_argflag(argstr_, default, help_, return_specified)
        >>> result = ('(parsed_val, was_specified) = %s' % (str((parsed_val, was_specified)),))
        >>> print(result)
    """
    if argv is None:
        argv = sys.argv
    assert isinstance(default, bool), 'default must be boolean'
    argstr_list = meta_util_iter.ensure_iterable(argstr_)
    #if VERYVERBOSE:
    #    print('[util_arg] checking argstr_list=%r' % (argstr_list,))
    # arg registration
    _register_arg(argstr_list, bool, default, help_)
    parsed_val = default
    was_specified = False

    if debug is None:
        debug = DEBUG

    # Check environment variables for default as well as argv
    import os
    #"""
    #set UTOOL_NOCNN=True
    #export UTOOL_NOCNN True
    #"""
    #argv_orig = argv[:]
    # HACK: make this not happen very time you loop
    for key, val in os.environ.items():
        key = key.upper()
        sentinal = 'UTOOL_'
        if key.startswith(sentinal):
            flag = '--' + key[len(sentinal):].lower().replace('_', '-')
            if val.upper() in ['TRUE', 'ON']:
                pass
            elif val.upper() in ['FALSE', 'OFF']:
                continue
            else:
                continue
                #flag += '=False'
            new_argv = [flag]
            argv = argv[:] + new_argv
            if debug:
                print('ENV SPECIFIED COMMAND LINE')
                print('argv.extend(new_argv=%r)' % (new_argv,))

    for argstr in argstr_list:
        #if VERYVERBOSE:
        #    print('[util_arg]   * checking argstr=%r' % (argstr,))
        if not (argstr.find('--') == 0 or (argstr.find('-') == 0 and len(argstr) == 2)):
            raise AssertionError('Invalid argstr: %r' % (argstr,))
        if not need_prefix:
            noprefix = argstr.replace('--', '')
            if noprefix in argv:
                parsed_val = True
                was_specified = True
                break
        #if argstr.find('--no') == 0:
            #argstr = argstr.replace('--no', '--')
        noarg = argstr.replace('--', '--no')
        if argstr in argv:
            parsed_val = True
            was_specified = True
            #if VERYVERBOSE:
            #    print('[util_arg]   * ...WAS_SPECIFIED. AND PARSED')
            break
        elif noarg in argv:
            parsed_val = False
            was_specified = True
            #if VERYVERBOSE:
            #    print('[util_arg]   * ...WAS_SPECIFIED. AND NOT PARSED')
            break
        elif argstr + '=True' in argv:
            parsed_val = True
            was_specified = True
            break
        elif argstr + '=False' in argv:
            parsed_val = False
            was_specified = True
            break

    if return_specified is None:
        return_specified = return_was_specified

    if return_specified:
        return parsed_val, was_specified
    else:
        return parsed_val
Checks if the commandline has a flag or a corresponding noflag

    Args:
        argstr_ (str, list, or tuple): the flag to look for
        default (bool): dont use this (default = False)
        help_ (str): a help string (default = '')
        return_specified (bool): returns if flag was specified or not (default = False)

    Returns:
        tuple: (parsed_val, was_specified)

    TODO:
        depricate return_was_specified

    CommandLine:
        python -m utool.util_arg --exec-get_argflag --noface --exec-mode
        python -m utool.util_arg --exec-get_argflag --foo --exec-mode
        python -m utool.util_arg --exec-get_argflag --no-foo --exec-mode
        python -m utool.util_arg --exec-get_argflag --foo=True --exec-mode
        python -m utool.util_arg --exec-get_argflag --foo=False  --exec-mode

    Example:
        >>> # DISABLE_DOCTEST
        >>> from utool.util_arg import *  # NOQA
        >>> argstr_ = '--foo'
        >>> default = False
        >>> help_ = ''
        >>> return_specified = True
        >>> (parsed_val, was_specified) = get_argflag(argstr_, default, help_, return_specified)
        >>> result = ('(parsed_val, was_specified) = %s' % (str((parsed_val, was_specified)),))
        >>> print(result)