Returns positional args specified directly after the scriptname
    and before any args starting with '-' on the commandline.

def get_cmdline_varargs(argv=None):
    """
    Returns positional args specified directly after the scriptname
    and before any args starting with '-' on the commandline.
    """
    if argv is None:
        argv = sys.argv
    scriptname = argv[0]
    if scriptname == '':
        # python invoked by iteself
        pos_start = 0
        pos_end = 0
    else:
        pos_start = pos_end = 1
        for idx in range(pos_start, len(argv)):
            if argv[idx].startswith('-'):
                pos_end = idx
                break
        else:
            pos_end = len(argv)
    cmdline_varargs = argv[pos_start:pos_end]
    return cmdline_varargs