useful python sample code