Dev:
        argx = ['fdsf', '432443432432', 43423432, 'fdsfsd', 3.2, True]
        memlist = list(map(cachestr_repr, argx))

    Ignore:
        argx = key_argx[0]
        argval = args[argx]
        val = argval
        %timeit repr(argval)
        %timeit to_json(argval)
        %timeit utool.hashstr(to_json(argval))
        %timeit memoryview(argval)

    Example:
        >>> # DISABLE_DOCTEST
        >>> from utool.util_cache import *  # NOQA
        >>> import utool as ut
        >>> use_hash = None
        >>> func = consensed_cfgstr
        >>> args = ('a', 'b', 'c', 'd')
        >>> kwargs = {}
        >>> key_argx = [0, 1, 2]
        >>> key_kwds = []
        >>> kwdefaults = ut.util_inspect.get_kwdefaults(func)
        >>> argnames   = ut.util_inspect.get_argnames(func)
        >>> get_cfgstr_from_args(func, args, kwargs, key_argx, key_kwds, kwdefaults, argnames)

    Example:
        >>> # DISABLE_DOCTEST
        >>> from utool.util_cache import *  # NOQA
        >>> import utool as ut
        >>> self = ut.LazyList
        >>> use_hash = None
        >>> func = self.append
        >>> args = ('a', 'b')
        >>> kwargs = {}
        >>> key_argx = [1]
        >>> key_kwds = []
        >>> kwdefaults = ut.util_inspect.get_kwdefaults(func)
        >>> argnames   = ut.util_inspect.get_argnames(func)
        >>> get_cfgstr_from_args(func, args, kwargs, key_argx, key_kwds, kwdefaults, argnames)

def get_cfgstr_from_args(func, args, kwargs, key_argx, key_kwds, kwdefaults,
                         argnames, use_hash=None):
    """
    Dev:
        argx = ['fdsf', '432443432432', 43423432, 'fdsfsd', 3.2, True]
        memlist = list(map(cachestr_repr, argx))

    Ignore:
        argx = key_argx[0]
        argval = args[argx]
        val = argval
        %timeit repr(argval)
        %timeit to_json(argval)
        %timeit utool.hashstr(to_json(argval))
        %timeit memoryview(argval)

    Example:
        >>> # DISABLE_DOCTEST
        >>> from utool.util_cache import *  # NOQA
        >>> import utool as ut
        >>> use_hash = None
        >>> func = consensed_cfgstr
        >>> args = ('a', 'b', 'c', 'd')
        >>> kwargs = {}
        >>> key_argx = [0, 1, 2]
        >>> key_kwds = []
        >>> kwdefaults = ut.util_inspect.get_kwdefaults(func)
        >>> argnames   = ut.util_inspect.get_argnames(func)
        >>> get_cfgstr_from_args(func, args, kwargs, key_argx, key_kwds, kwdefaults, argnames)

    Example:
        >>> # DISABLE_DOCTEST
        >>> from utool.util_cache import *  # NOQA
        >>> import utool as ut
        >>> self = ut.LazyList
        >>> use_hash = None
        >>> func = self.append
        >>> args = ('a', 'b')
        >>> kwargs = {}
        >>> key_argx = [1]
        >>> key_kwds = []
        >>> kwdefaults = ut.util_inspect.get_kwdefaults(func)
        >>> argnames   = ut.util_inspect.get_argnames(func)
        >>> get_cfgstr_from_args(func, args, kwargs, key_argx, key_kwds, kwdefaults, argnames)
    """
    #try:
    #fmt_str = '%s(%s)'
    import utool as ut
    hashstr_ = util_hash.hashstr27
    if key_argx is None:
        key_argx = list(range(len(args)))
    if key_kwds is None:
        key_kwds = ut.unique_ordered(list(kwdefaults.keys()) + list(kwargs.keys()))

    #def kwdval(key):
    #    return kwargs.get(key, kwdefaults.get(key, None))
    given_kwargs = ut.merge_dicts(kwdefaults, kwargs)

    arg_hashfmtstr = [argnames[argx] + '=(%s)' for argx in key_argx]
    #kw_hashfmtstr = [kwdefaults.get(key, '???') + '(%s)' for key in key_kwds]
    kw_hashfmtstr = [key + '=(%s)' for key in key_kwds]
    cfgstr_fmt = '_'.join(chain(arg_hashfmtstr, kw_hashfmtstr))
    #print('cfgstr_fmt = %r' % cfgstr_fmt)
    argrepr_iter = (cachestr_repr(args[argx]) for argx in key_argx)
    kwdrepr_iter = (cachestr_repr(given_kwargs[key]) for key in key_kwds)
    if use_hash is None:
        #print('conditional hashing args')
        argcfg_list = [hashstr_(argrepr) if len(argrepr) > 16 else argrepr
                       for argrepr in argrepr_iter]
        kwdcfg_list =  [hashstr_(kwdrepr) if len(kwdrepr) > 16 else kwdrepr
                        for kwdrepr in kwdrepr_iter]
    elif use_hash is True:
        #print('hashing args')
        argcfg_list = [hashstr_(argrepr) for argrepr in argrepr_iter]
        kwdcfg_list =  [hashstr_(kwdrepr) for kwdrepr in kwdrepr_iter]
    else:
        argcfg_list = list(argrepr_iter)
        kwdcfg_list = list(kwdrepr_iter)
    #print('formating args and kwargs')
    cfgstr = cfgstr_fmt % tuple(chain(argcfg_list, kwdcfg_list))
    #print('made cfgstr = %r' % cfgstr)
    return cfgstr