useful python code fragments