def process_wrapped_text(text: str) -> str:
	"""Handles wrapped text in some documents by replacing linebreaks between a
	a pair of <p> and </p> tags with spaces.

	Args:
		text (str): text string to process.
	
	Returns:
		str: processed text string.
	"""
	segments = text.split('\n')
	segments_new = []
	in_p = False
	for segment in segments:
		if in_p:
			if segment == '</P>':
				segments_new.append(segment)
				in_p = False
			else:
				if segments_new[-1]:
					segments_new[-1] += ' '
				segments_new[-1] += segment
		else:
			segments_new.append(segment)
			if segment == '<P>':
				segments_new.append('')
				in_p = True
	return '\n'.join(segments_new)