+algo=smesh.xxxx ==> algo=smeshBuilder.xxxx
replace
-------
-import smesh, SMESH, SALOMEDS
+import smesh, SMESH
smesh.SetCurrentStudy(theStudy)
with
----
-import SMESH, SALOMEDS
+import SMESH
from salome.smesh import smeshBuilder
smesh = smeshBuilder.New(salome.myStudy)
you also need to modify some lines where smeshBuilder is used instead of smesh
-algo=smesh.xxxx ==> algo.smeshBuilder.xxxx
+algo=smesh.xxxx ==> algo=smeshBuilder.xxxx
See also SMESH User's Guide for more details