Language: Python
Label: vulnerable
CWE: NVD-CWE-noinfo \u2014 

Code:
    def lookup_internal_function(self, method_name, args_ir, ast_source):
        # TODO is this the right module for me?
        """
        Using a list of args, find the internal method to use, and
        the kwargs which need to be filled in by the compiler
        """

        sig = self.sigs["self"].get(method_name, None)

        def _check(cond, s="Unreachable"):
            if not cond:
                raise CompilerPanic(s)

        # these should have been caught during type checking; sanity check
        _check(sig is not None)
        _check(sig.internal)
        _check(len(sig.base_args) <= len(args_ir) <= len(sig.args))
        # more sanity check, that the types match
        # _check(all(l.typ == r.typ for (l, r) in zip(args_ir, sig.args))

        num_provided_kwargs = len(args_ir) - len(sig.base_args)
        num_kwargs = len(sig.default_args)
        kwargs_needed = num_kwargs - num_provided_kwargs

        kw_vals = list(sig.default_values.values())[:kwargs_needed]

        return sig, kw_vals