Same script for android and iOS

Hi everyone,

How can i execute same script for android and ios
or any workaround to execute same test cases for both of the platfrom

Same scripts will not work for both the platforms as is.

For example: Locators will likely change for both platforms , you will have to create framework which has common code as base class and specific code for iOS and android and then can intro parameter to choose to run iOS or Android

Thanks!!
One favour, can you give me sample script for same in python if possible…