<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_contents(self):
        '''Returns the contents of the deque as a string'''
        # block until command completes or timesout (separate from the plugin
        # hitting a timeout)
        while self.running:
            pass
        if not self.binary:
            return ''.join(ln.decode('utf-8', 'ignore') for ln in self.deque)
        else:
            return b''.join(ln for ln in self.deque)