def get_type(args_str, entry_type):
    """Determines the Python method type (METH_NOARGS or METH_VARARGS)
    from the C++ argument list and type of function.

    """
    # The C-method-implementations accept self as the first argument,
    # so a one-argument method will be invoked with zero arguments in Python.
    no_args = 1 if entry_type == "method" else 0
    return ("METH_NOARGS" if len(args_str.split(",")) == no_args
            else "METH_VARARGS")