Python Create Function From String To Json