adding python method and its testing part