<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def remove_newlines(xml):
 r"""Remove newlines in the xml. If the newline separates words in text, then replace with a space instead. '<p>para one</p><p>para two</p>' '<p>line one line two</p>' 'one 1' 'hey! more text!' """

    # Normalize newlines.
    xml = xml.replace('\r\n', '\n')
    xml = xml.replace('\r', '\n')
    # Remove newlines that don't separate text. The remaining ones do separate text.
    xml = re.sub(r'(?<=[>\s])\n(?=[<\s])', '', xml)
    xml = xml.replace('\n', ' ')
    return xml.strip()