Python Convert String Into Binary Search