<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def get_length(self, length, trim=0, offset=0):
 """Return string at current position + length. If trim == true then get as much as possible before eos. """

        if trim and not self.has_space(offset + length):
            return self.string[self.pos + offset:]
        elif self.has_space(offset + length):
            return self.string[self.pos + offset:self.pos + offset + length]
        else:
            return ''