def _changeMs(self, line):
        """Change the ms part in the string if needed."""
        # use the position of the last space instead
        try:
            last_space_pos = line.rindex(' ')
        except ValueError:
            return line
        else:
            end_str = line[last_space_pos:]
            new_string = line
            if end_str[-2:] == 'ms' and int(end_str[:-2]) >= 1000:
                # isolate the number of milliseconds
                ms = int(end_str[:-2])
                # create the new string with the beginning part of the
                # log with the new ms part added in
                new_string = (line[:last_space_pos] +
                              ' (' + self._msToString(ms) + ')' +
                              line[last_space_pos:])
            return new_string
Change the ms part in the string if needed.