def formatted(self, func):
other = EscapedString.__new__(EscapedString)<EOL>other.strings = []<EOL>for is_literal, value in self.strings:<EOL><INDENT>if not is_literal:<EOL><INDENT>value = func(value)<EOL><DEDENT>other.strings.append((is_literal, value))<EOL><DEDENT>return other<EOL>
Return the string with non-literal parts formatted.

        Args:
            func (callable): Callable that translates a string into a
                formatted string.

        Returns:
            `EscapedString` object.