'ends(s) is TRUE <=> k0,...k ends with the string s.'

def ends(self, s):

    length = len(s)
    if (s[(length - 1)] != self.b[self.k]):
        return 0
    if (length > ((self.k - self.k0) + 1)):
        return 0
    if (self.b[((self.k - length) + 1):(self.k + 1)] != s):
        return 0
    self.j = (self.k - length)
    return 1
