Python script to convert objects