def _K1(n, s, t, lambda_decay=0.5):
    """
    K'_n(s,t) in the original article; auxiliary intermediate function; recursive function
    :param n: length of subsequence
    :type n: int
    :param s: document #1
    :type s: str
    :param t: document #2
    :type t: str
    :return: intermediate float value
    """
    if n == 0:
        return 1
    elif min(len(s), len(t)) < n:
        return 0
    else:
        part_sum = 0
        for j in range(1, len(t)):
            if t[j] == s[-1]:
    #not t[:j-1] as in the article but t[:j] because of Python slicing rules!!!
                part_sum += _K1(n - 1, s[:-1], t[:j]) * (lambda_decay ** (len(t) - (j + 1) + 2))
        result = lambda_decay * _K1(n, s[:-1], t) + part_sum
        return result