added python code for functions