Explain logic behind binary search in ListOfExpressionsFormatter._format_code