def _secure_compare(x, y):
    """
    Compare 2 strings securely in order to avoid
    a timing attack
    """
    if len(x) != len(y):
        return False
    result = 0
    for a, b in zip(x, y):
        result |= ord(a) ^ ord(b)
    return result == 0
