Python Create Function From String To Datetime