migrating the code to  python arctoolbox