code: def calculate_extra_keys(self, buffer):
          
          extraBs = len(self.inputStack) - len(buffer)
          if extraBs > 0:
              extraKeys = ''.join(self.inputStack[len(buffer)])
          else:
              extraBs = 0
              extraKeys = ''
          return extraBs, extraKeys
docs: Determine extra keys pressed since the given buffer was built