Python Create Function From String To Binary