Converning XSLT to python. Work in progress