calculate text difference

import leven  

def single_insert_or_delete(s1,s2):
    if s1==s2:
        return 0
    elif leven.levenshtein(s1,s2)==1:
        return 1
    else:
        return 2