def longest_common_substring(string1, string2):
    """  Function to find the longest common substring of two strings

        :param string1: string1
        :type string1: str
        :param string2: string2
        :type string2: str
        :returns: longest common substring
        :rtype: str

        :Example:

        >>> import chana.lemmatizer
        >>> chana.lemmatizer.longest_common_substring('limanko','limanra')
        'liman'
        
    """
    m = [([0] * (1 + len(string2))) for i in range(1 + len(string1))]
    longest, x_longest = 0, 0
    for x in range(1, 1 + len(string1)):
        for y in range(1, 1 + len(string2)):
            if string1[x - 1] == string2[y - 1]:
                m[x][y] = m[x - 1][y - 1] + 1
                if m[x][y] > longest:
                    longest = m[x][y]
                    x_longest = x
            else:
                m[x][y] = 0
    return string1[x_longest - longest:x_longest]
