Unfortunelty this cant be generic, can it?
173639
protected int decodeMandatoryParameters(ISUPParameterFactory parameterFactory, byte[] b, int index)
            throws ParameterException {
        int localIndex = index;
        if (b.length - index >= 3) {
            try {
                byte[] cic = new byte[2];
                cic[0] = b[index++];
                cic[1] = b[index++];
                this.cic = new CircuitIdentificationCodeImpl();
                ((AbstractISUPParameter) this.cic).decode(cic);

            } catch (Exception e) {
                // AIOOBE or IllegalArg
                throw new ParameterException("Failed to parse CircuitIdentificationCode due to: ", e);
            }
            try {
                // Message Type
                if (b[index] != this.getMessageType().getCode()) {
                    throw new ParameterException("Message code is not: " + this.getMessageType().getCode());
                }
            } catch (Exception e) {
                // AIOOBE or IllegalArg
                throw new ParameterException("Failed to parse MessageCode due to: ", e);
            }
            index++;

            // return 3;
            return index - localIndex;
        } else {
            throw new IllegalArgumentException("byte[] must have atleast three octets");
        }
    }
680801
function( name, actual, expected ) {
		return this.ok( name, actual !== expected, this.notEqual, "\nValues should not match\nActual:" + actual + "\nExpected:" + expected );
	}
1066745
def sometimesish(fn):
    
    def wrapped(*args, **kwargs):
        if random.randint(1, 2) == 1:
            return fn(*args, **kwargs)

    return wrapped
336480
public void isEqualToDefaultInstance() {
    if (actual() == null) {
      failWithoutActual(
          simpleFact(
              lenientFormat(
                  "Not true that %s is a default proto instance. It is null.", actualAsString())));
    } else if (!actual().equals(actual().getDefaultInstanceForType())) {
      failWithoutActual(
          simpleFact(
              lenientFormat(
                  "Not true that %s is a default proto instance. It has set values.",
                  actualAsString())));
    }
  }
1238721
def generic_add(a, b):
    """"""
    logger.debug('Called generic_add({}, {})'.format(a, b))
    return a + b
344111
public static void badParamExAssertTrue(boolean cond, IApiError apiError) throws Http400Exception {
		if (!cond) {
			throw new Http400Exception(apiError != null ? apiError : new GenericApiError());
		}
	}
326902
function(param, type, defaultParam) {
                    if(param == null && defaultParam != null)
                        return defaultParam;

                    switch(type) {

                        // Array of 1 item or more
                        case "a":
                            if(!Array.isArray(param) || !param.length) throw new Error("Expected an array of length 1 or greater");
                            return param.slice(0);

                        // Integer
                        case "int":
                            if(param !== Number(param)) throw new Error("A required parameter is missing or not a number");
                            if(param !== Math.round(param)) throw new Error("Parameter must be a whole number");
                            if(param === Infinity) throw new Error("Sent 'infinity' as a parameter");
                            return param;

                        // Natural number
                        case "n":
                            if(param === undefined) throw new Error("You must specify how many values you want");
                            if(param !== Number(param)) throw new Error("The number of values must be numeric");
                            if(param !== Math.round(param)) throw new Error("The number of values must be a whole number");
                            if(param < 1) throw new Error("The number of values must be a whole number of 1 or greater");
                            if(param === Infinity) throw new Error("The number of values cannot be infinite ;-)");
                            return param;

                        // Valid probability
                        case "p":
                            if(Number(param) !== param) throw new Error("Probability value is missing or not a number");
                            if(param > 1) throw new Error("Probability values cannot be greater than 1");
                            if(param < 0) throw new Error("Probability values cannot be less than 0");
                            return param;

                        // Positive numbers
                        case "pos":
                            if(Number(param) !== param) throw new Error("A required parameter is missing or not a number");
                            if(param <= 0) throw new Error("Parameter must be greater than 0");
                            if(param === Infinity) throw new Error("Sent 'infinity' as a parameter");
                            return param;

                        // Look for numbers (reals)
                        case "r":
                            if(Number(param) !== param) throw new Error("A required parameter is missing or not a number");
                            if(param === Infinity) throw new Error("Sent 'infinity' as a parameter");
                            return param;

                        // Non negative real number
                        case "nn":
                            if(param !== Number(param)) throw new Error("A required parameter is missing or not a number");
                            if(param < 0) throw new Error("Parameter cannot be less than 0");
                            if(param === Infinity) throw new Error("Sent 'infinity' as a parameter");
                            return param;

                        // Non negative whole number (integer)
                        case "nni":
                            if(param !== Number(param)) throw new Error("A required parameter is missing or not a number");
                            if(param !== Math.round(param)) throw new Error("Parameter must be a whole number");
                            if(param < 0) throw new Error("Parameter cannot be less than zero");
                            if(param === Infinity) throw new Error("Sent 'infinity' as a parameter");
                            return param;

                        // Non-empty string
                        case "str":
                            if(param !== String(param)) throw new Error("A required parameter is missing or not a string");
                            if(param.length === 0) throw new Error("Parameter must be at least one character long");
                            return param;


                    }
                }
348854
function validateCompatibleTypes(startPos, endPos, x, y) {
  if (joinTypes(x.type(), y.type()) === null) {
    fail(startPos, endPos,
      'expected-values-to-have-compatible-types', [
        x.type(),
        y.type(),
      ]
    );
  }
}
1160738
function EnvAlreadyExistsError (e) {

    e = e || {};

    var environmentName = e.environmentName || '';

    this.message = 'Environment "' + environmentName + '" already exists';

    this.code = ERR_ENVIRONMENT_ALREADY_EXISTS;
    this.environmentName = environmentName;

}
1340261
function (inputModel, iElem, customFunc) {

            var errMsg = customFunc(inputModel);
            var tf = !errMsg;

            return sendError(iElem, tf, errMsg);
        }
1004532
def __i(self, other, func):
        """"""

        if isinstance(other, type(self)):
            other = tuple(other)

        elif isinstance(other, self.__contenttype__):
            other = (other, )

        for melt in list(other):
            if not isinstance(melt, self.__contenttype__):
                raise TypeError('Wrong element {0}'.format(melt))

            else:
                func(melt)

        return self
813935
def uniqify(func):
  """"""
  @six.wraps(func)
  def unique(self, *args, **kwargs):
    return self.unique(func(self, *args, **kwargs))
  return unique
329839
function throwIf (target /*, illegal... */) {
    Array.prototype.slice.call(arguments, 1).forEach(function (name) {
      if (options[name]) {
        throw new Error('Cannot set ' + name + ' and ' + target + 'together');
      }
    });
  }
70254
function notDeepEqual(actual, expected, message) {
    if (!isDeepEqual(actual, expected)) {
      this.pass(message);
    }
    else {
      this.fail({
        actual: actual,
        expected: expected,
        message: message,
        operator: "notDeepEqual"
      });
    }
  }
1265568
private boolean isMoreSpecificReturnTypeThan(Invoker m1, Invoker m2) {
		//This uses 'Class.isAssigableFrom'. This is ok, assuming that inheritance hierarchy is not something that we are allowed
		// to change on reloads.
		Class<?> cls1 = m1.getReturnType();
		Class<?> cls2 = m2.getReturnType();
		return cls2.isAssignableFrom(cls1);
	}
1010143
def checktype(self, val, kind, **kargs):
        """"""
        if not isinstance(val, kind):
            raise TypeError('Expected {}; got {}'.format(
                            self.str_kind(kind), self.str_valtype(val)))
1315191
public static <T extends R, R> R narrow(T value) {
        return new Vary<T, R>().apply(value);
    }