python sub with function