from perl2python