**This code was taken from the django 1.4.x codebase along with the test code**
    Returns True if the two strings are equal, False otherwise.

    The time taken is independent of the number of characters that match.
508073
def constant_time_compare(val1, val2):  # noqa: C901
    
    if len(val1) != len(val2):
        return False

    if isinstance(val1, bytes):
        val1 = val1.decode("ascii")
    if isinstance(val2, bytes):
        val2 = val2.decode("ascii")

    result = 0
    for x, y in zip(val1, val2):
        result |= ord(x) ^ ord(y)
    return result == 0
860849
private function validateEquals(): bool
    {
        $isValid = \mb_strlen((string)$this->value, 'UTF-8') == $this->options['length'] ? true : false;
        if (!$isValid) {
            $this->setError(self::VALIDATOR_ERROR_STRING_LENGTH_NOT_MATCH);
        }
        return $isValid;
    }
592775
def is_matching_rule(self, request):
		""""""
		# First, if in DEBUG mode and with django-debug-toolbar, we skip
		#   this entire process.
		if settings.DEBUG and request.path.startswith("/__debug__"):
			return True

		# Second we check against matches
		match = resolve(request.path, getattr(request, "urlconf", settings.ROOT_URLCONF))
		if "({0})".format(match.app_name) in EXEMPT:
			return True

		if "[{0}]".format(match.namespace) in EXEMPT:
			return True

		if "{0}:{1}".format(match.namespace, match.url_name) in EXEMPT:
			return True

		if match.url_name in EXEMPT:
			return True

		# Third, we check wildcards:
		for exempt in [x for x in EXEMPT if x.startswith("fn:")]:
			exempt = exempt.replace("fn:", "")
			if fnmatch.fnmatch(request.path, exempt):
				return True

		return False
260584
def str_equals(a, b):
    
    al = len(a)
    bl = len(b)
    match = True
    for i in xrange(0, min(al, bl)):
        match &= a[i] == b[i]
    return match
665064
private static boolean failedEquivalenceCheck(
      EquivalenceMatch eqMatch, EquivalenceMethod eqMethod) {
    return eqMatch == EquivalenceMatch.VALUE_MISMATCH
        || (eqMatch == EquivalenceMatch.NO_KEY_MATCH && eqMethod != EquivalenceMethod.INVARIANT);
  }
215326
public boolean areEquals(String str1, String str2, String str3) {

		return (str1 == null && str2 == null && str3 == null
				|| str1 != null && str2 != null && str3 != null && str1.equals(str2) && str2.equals(str3));
	}
659968
public boolean contentEqualsIgnoreCase(CharSequence string) {
        if (string == null || string.length() != length()) {
            return false;
        }

        if (string.getClass() == AsciiString.class) {
            AsciiString rhs = (AsciiString) string;
            for (int i = arrayOffset(), j = rhs.arrayOffset(); i < length(); ++i, ++j) {
                if (!equalsIgnoreCase(value[i], rhs.value[j])) {
                    return false;
                }
            }
            return true;
        }

        for (int i = arrayOffset(), j = 0; i < length(); ++i, ++j) {
            if (!equalsIgnoreCase(b2c(value[i]), string.charAt(j))) {
                return false;
            }
        }
        return true;
    }
20648
def equals(self, other):
        
        if self.is_(other):
            return True

        if not isinstance(other, Index):
            return False

        if not isinstance(other, MultiIndex):
            other_vals = com.values_from_object(ensure_index(other))
            return array_equivalent(self._ndarray_values, other_vals)

        if self.nlevels != other.nlevels:
            return False

        if len(self) != len(other):
            return False

        for i in range(self.nlevels):
            self_codes = self.codes[i]
            self_codes = self_codes[self_codes != -1]
            self_values = algos.take_nd(np.asarray(self.levels[i]._values),
                                        self_codes, allow_fill=False)

            other_codes = other.codes[i]
            other_codes = other_codes[other_codes != -1]
            other_values = algos.take_nd(
                np.asarray(other.levels[i]._values),
                other_codes, allow_fill=False)

            # since we use NaT both datetime64 and timedelta64
            # we can have a situation where a level is typed say
            # timedelta64 in self (IOW it has other values than NaT)
            # but types datetime64 in other (where its all NaT)
            # but these are equivalent
            if len(self_values) == 0 and len(other_values) == 0:
                continue

            if not array_equivalent(self_values, other_values):
                return False

        return True
198390
public static boolean equalsAny(final String str, String[] searchChars) {
        
        for(String search : searchChars) {
            if(str.equals(search)) {
                return true;
            }
        }
        
        return false;
        
    }
921973
function equal(a, b) {
  if (a === b) return true

  let arrA = isArray(a)
  let arrB = isArray(b)
  let length = 0

  if (arrA && arrB) {
    length = a.length
    if (length !== b.length) return false
    for (let i = length; i-- !== 0;) { if (!equal(a[i], b[i])) return false }
    return true
  }

  if (arrA !== arrB) return false

  let dateA = a instanceof Date
  let dateB = b instanceof Date
  if (dateA !== dateB) return false
  if (dateA && dateB) return a.getTime() === b.getTime()

  let regexpA = a instanceof RegExp
  let regexpB = b instanceof RegExp
  if (regexpA !== regexpB) return false
  if (regexpA && regexpB) return a.toString() === b.toString()

  if (a instanceof Object && b instanceof Object) {
    let keys = keyList(a)
    length = keys.length

    if (length !== keyList(b).length) { return false }

    for (let i = length; i-- !== 0;) { if (!hasProp.call(b, keys[i])) return false }

    let key = ''
    for (let i = length; i-- !== 0;) {
      key = keys[i]
      if (!equal(a[key], b[key])) return false
    }

    return true
  }

  return false
}
564578
public boolean matches(Request req) {
        if (!method.equals(req.getMethod())) return false;
        if (useRegexForPath) {
            if (!req.getPath().getPath().matches(basePath)) return false;
        } else {
            if (!basePath.equals(req.getPath().getPath())) return false;
        }
        if (!queries.keySet().containsAll(req.getQuery().keySet())) return false;
        if (!req.getNames().containsAll(headers.keySet())) return false;

        try {
            if (!isEmpty(bodyMustContain) && !req.getContent().contains(bodyMustContain))
                return false;
        } catch (IOException e) {
            return false;
        }

        for (Map.Entry<String, String> reqQuery : req.getQuery().entrySet()) {
            String respRegex = queries.get(reqQuery.getKey());
            if (!reqQuery.getValue().matches(respRegex)) return false;
        }
        for(Map.Entry<String, String> header : headers.entrySet()) {
            String headerValueRegex = header.getValue();
            if(!req.getValue(header.getKey()).matches(headerValueRegex)) return false;
        }
        return true;
    }
844617
private static boolean isOptionCodeMatch(final Object option, final Object data) {
		// If the option is an instance of Option, check if the data value is the "CODE" value on the option
		if (option instanceof Option) {
			String optionCode = ((Option) option).getCode();
			String matchAsString = String.valueOf(data);
			boolean equal = Util.equals(optionCode, matchAsString);
			return equal;
		}
		return false;
	}
272500
@Deprecated
    public static boolean equalsChars(CharSequence a, CharSequence b) {
        // do length test first for fast path
        return a.length() == b.length() && compare(a,b) == 0;
    }
995165
public static boolean equal(SoyValue operand0, SoyValue operand1) {
    // Treat the case where either is a string specially.
    // TODO(gboyer): This should probably handle SanitizedContent == SanitizedContent, even though
    // Javascript doesn't handle that case properly. http://b/21461181
    if (operand0 instanceof StringData || operand0 instanceof UnsanitizedString) {
      return compareString(operand0.stringValue(), operand1);
    }
    if (operand1 instanceof StringData || operand1 instanceof UnsanitizedString) {
      return compareString(operand1.stringValue(), operand0);
    }
    return Objects.equals(operand0, operand1);
  }
896080
private boolean exactMatch(String str, int i) {
    int end = str.length() - i;
    for (String p : _patterns) {
      int start = end - p.length();
      if (start >= 0 && str.regionMatches(start, p, 0, p.length())) {
        return true;
      }
    }
    return false;
  }
184958
private static boolean isEqual(String string1, String string2) {
        return (string1 == null && string2 == null) || (string1 != null && string1.equals(string2));
    }
14832
def is_equal(self, other):
        
        if not isinstance(other, DictCell):
            return False
        for (this, that) in itertools.izip_longest(self, other):
            if this[0] != that[0]:
                # compare key names
                return False
            if not this[1].is_equal(that[1]):
                # compare cells
                return False
        return True