def getopt(args, shortopts, longopts = []):

    opts = []
    if type(longopts) == type(""):
        longopts = [longopts]
    else:
        longopts = list(longopts)
    while args and args[0].startswith('-') and args[0] != '-':
        if args[0] == '--':
            args = args[1:]
            break
        if args[0].startswith('--'):
            opts, args = do_longs(opts, args[0][2:], longopts, args[1:])
        else:
            opts, args = do_shorts(opts, args[0][1:], shortopts, args[1:])

    return opts, args
Consumes all items in an iterable and returns a count.
dataset/ETHPy150Open azoft-dev-team/imagrium/env/Lib/getopt.py/getopt--crossover with--dataset/ETHPy150Open mediawiki-utilities/python-mediawiki-utilities/mw/util/iteration/count.py/count