def parse_args(argv, defaults=None, expected_argc=0):
    opts = {}
    if defaults:
        opts.update(defaults)

    args = []

    i = 0
    while i < len(argv):
        if argv[i][0] == '-':
            arg = argv[i].lstrip('-')
            if '=' in arg:
                k, v = arg.split('=', 2)
                if k in defaults:
                    if type(defaults[k]) == float:
                        opts[k] = float(v)
                    elif type(defaults[k]) == int:
                        opts[k] = int(v)
                    else:
                        opts[k] = v
            else:
                opts[arg] = True
        else:
            args.append(argv[i])
        i += 1

    while len(args) < expected_argc:
        args.append(None)
    return opts, args
dataset/ETHPy150Open ngsutils/ngsutils/ngsutils/support/ngs_utils.py/parse_args/original