figure out how to correctly start the user code.  warn if
    args are passed on the command line, but the code doesn't 
    accept them.

def _start_usercode(entryfunction, netobj, codeargdict):
    '''
    figure out how to correctly start the user code.  warn if
    args are passed on the command line, but the code doesn't 
    accept them.
    '''
    # p22, python3 lang ref
    numargs = entryfunction.__code__.co_argcount
    takenet = numargs >= 1
    takestarargs = entryfunction.__code__.co_flags & 0x04 == 0x04
    takekw = entryfunction.__code__.co_flags & 0x08 == 0x08

    args = codeargdict['args']
    kwargs = codeargdict['kwargs']

    if args and not takestarargs:
        log_warn("User code arguments passed on command line, "
            "but the user code doesn't take arguments")
    if kwargs and not takekw:
        log_warn("User code keyword args passed on command line, "
            "but the user code doesn't take kwargs")

    if not takenet:
        raise RuntimeError("Your code does not appear to accept at "
            "least one parameter for the net object")

    # omg, this sucks.
    if takestarargs and takekw:
        entryfunction(netobj, *args, **kwargs)
    elif takestarargs:
        entryfunction(netobj, *args)
    elif takekw:
        entryfunction(netobj, **kwargs)
    else:
        entryfunction(netobj)