def get_arg_dict(argv=None, prefix_list=['--'], type_hints={}):
    r
    if argv is None:
        argv = sys.argv
    arg_dict = {}
    def startswith_prefix(arg):
        return any([arg.startswith(prefix) for prefix in prefix_list])
    def argx_has_value(argv, argx):
        if argv[argx].find('=') > -1:
            return True
        if argx + 1 < len(argv) and not startswith_prefix(argv[argx + 1]):
            return True
        return False
    def get_arg_value(argv, argx, argname):
        if argv[argx].find('=') > -1:
            return '='.join(argv[argx].split('=')[1:])
        else:
            type_ = type_hints.get(argname, None)
            if type_ is None:
                return argv[argx + 1]
            else:
                return parse_arglist_hack(argx, argv=argv)
    for argx in range(len(argv)):
        arg = argv[argx]
        for prefix in prefix_list:
            if arg.startswith(prefix):
                argname = arg[len(prefix):]
                if argx_has_value(argv, argx):
                    if arg.find('=') > -1:
                        argname = arg[len(prefix):arg.find('=')]
                    argvalue = get_arg_value(argv, argx, argname)
                    arg_dict[argname] = argvalue
                else:
                    arg_dict[argname] = True
                break
    return arg_dict