I would suggest that you use that function like this, making use of the SPSSINC TRANS extension command.
data list free /str1(a8) str2(a8).
begin data
untied united
end data
spssinc trans result = lev
/formula "extendedTransforms.levenshteindistance(str1, str2)".
The old trans module is not installed with the Statistics Python Essentials, but I think you can get it by following the Python Modules link on the SPSS Community website.
=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD