def levenshtein_distance(str1, str2):
    """
        Return the minimum number of character deletions,
        insertions and/or substitutions between two strings.
        :param str1: first string
        :param str2: second string
        :type str1: string
        :type str2: string
        :returns: levenshtein distance between the two strings
        :rtype: int
    """
    cols, rows = len(str1), len(str2)
    matrix = [[0 for col in range(cols + 1)] for row in range(rows + 1)]

    # Distances from empty string
    for col in range(1, cols + 1):
        matrix[0][col] = col
    for row in range(1, rows + 1):
        matrix[row][0] = row

    for row in range(1, rows + 1):
        for col in range(1, cols + 1):
            cost = 0 if str1[col - 1] == str2[row - 1] else 1
            matrix[row][col] = min(
                matrix[row][col - 1] + 1,  # deletion
                matrix[row - 1][col] + 1,  # insertion
                matrix[row - 1][col - 1] + cost)  # substitution

    return matrix[rows][cols]