def argval(key, default=util_const.NoParam, argv=None):
if argv is None:  <EOL><INDENT>argv = sys.argv<EOL><DEDENT>keys = [key] if isinstance(key, six.string_types) else key<EOL>n_max = len(argv) - <NUM_LIT:1><EOL>for argx, item in enumerate(argv):<EOL><INDENT>for key_ in keys:<EOL><INDENT>if item == key_:<EOL><INDENT>if argx < n_max:<EOL><INDENT>value = argv[argx + <NUM_LIT:1>]<EOL>return value<EOL><DEDENT><DEDENT>elif item.startswith(key_ + '<STR_LIT:=>'):<EOL><INDENT>value = '<STR_LIT:=>'.join(item.split('<STR_LIT:=>')[<NUM_LIT:1>:])<EOL>return value<EOL><DEDENT><DEDENT><DEDENT>value = default<EOL>return value<EOL>
Get the value of a keyword argument specified on the command line.

Values can be specified as `<key> <value>` or `<key>=<value>`

Args:
    key (str or tuple): string or tuple of strings. Each key should be
        prefixed with two hyphens (i.e. `--`)
    default (Optional[object]): value to return if not specified
    argv (Optional[list]): overrides `sys.argv` if specified

Returns:
    str: value : the value specified after the key. It they key is
        specified multiple times, then the first value is returned.

TODO:
    - [ ] Can we handle the case where the value is a list of long paths?
    - [ ] Should we default the first or last specified instance of the flag.

Example:
    >>> import ubelt as ub
    >>> argv = ['--ans', '42', '--quest=the grail', '--ans=6', '--bad']
    >>> assert ub.argval('--spam', argv=argv) == ub.NoParam
    >>> assert ub.argval('--quest', argv=argv) == 'the grail'
    >>> assert ub.argval('--ans', argv=argv) == '42'
    >>> assert ub.argval('--bad', argv=argv) == ub.NoParam
    >>> assert ub.argval(('--bad', '--bar'), argv=argv) == ub.NoParam

Example:
    >>> # Test fix for GH Issue #41
    >>> import ubelt as ub
    >>> argv = ['--path=/path/with/k=3']
    >>> ub.argval('--path', argv=argv) == '/path/with/k=3'