Read data from the arm. Data is returned as a latin_1 encoded
            string, or raw bytes if 'raw' is True.

def read(self, timeout=READ_TIMEOUT, raw=False):
        ''' Read data from the arm. Data is returned as a latin_1 encoded
            string, or raw bytes if 'raw' is True. '''
        time.sleep(READ_SLEEP_TIME)
        raw_out = self.ser.read(self.ser.in_waiting)
        out = raw_out.decode(OUTPUT_ENCODING)

        time_waiting = 0
        while len(out) == 0 or ending_in(out.strip(OUTPUT_STRIP_CHARS), RESPONSE_END_WORDS) is None:
            time.sleep(READ_SLEEP_TIME)
            time_waiting += READ_SLEEP_TIME

            raw_out += self.ser.read(self.ser.in_waiting)
            out = raw_out.decode(OUTPUT_ENCODING)

            # TODO how to handle timeouts, if they're now unexpected?
            if time_waiting >= timeout:
                break

        if raw:
            return raw_out
        return out