I'm attempting to parse URLs from an XML sitemap that isn't mine. Unfortunately, some of the XML is poorly written and contains unescaped/invalid characters, such as ampersands.

This is the code block I'm using to parse through my XML file currently:

```
from xml.etree import ElementTree as ET

tree = ET.parse('test.xml')
root = tree.getroot()

name_space = '{http://www.sitemaps.org/schemas/sitemap/0.9}'

urls = []
for child in root.iter():
    for block in child.findall('{}url'.format(name_space)):
        for url in block.findall('{}loc'.format(name_space)):
            urls.append('{}\n'.format(url.text))

with open('sample_urls.txt', 'w+') as f:
    f.writelines(urls)

```

I'm running into this error when it encounters an unescaped URL: ParseError: not well-formed (invalid token).

How can I escape these issues and still continue parsing the file? I've come across the **escape()** function of the *xml.sax.saxutils* module, but not sure the best way to apply it based on what I currently have.