def _merge_prefix(deque, size):
 if ((len(deque) == 1) and (len(deque[0]) <= size)):
  return
 prefix = []
 remaining = size
 while (deque and (remaining > 0)):
  chunk = deque.popleft()
  if (len(chunk) > remaining):
   deque.appendleft(chunk[remaining:])
   chunk = chunk[:remaining]
  prefix.append(chunk)
  remaining -= len(chunk)
 if prefix:
  deque.appendleft(type(prefix[0])().join(prefix))
 if (not deque):
  deque.appendleft('')

def _merge_prefix ( deque , size ) : if ( ( len ( deque ) == 1 ) and ( len ( deque [ 0 ] ) <= size ) ) : return prefix = [ ] remaining = size while ( deque and ( remaining > 0 ) ) : chunk = deque . popleft ( ) if ( len ( chunk ) > remaining ) : deque . appendleft ( chunk [ remaining : ] ) chunk = chunk [ : remaining ] prefix . append ( chunk ) remaining -= len ( chunk ) if prefix : deque . appendleft ( type ( prefix [ 0 ] ) ( ) . join ( prefix ) ) if ( not deque ) : deque . appendleft ( '' )
replace the first entries in a deque of strings with a single string of up to size bytes .