def remove_namespace(doc, namespace):
"""Remove namespace in the passed document in place."""
ns = u'{%s}' % namespace
nsl = len(ns)
for elem in doc.getiterator():
if elem.tag.startswith(ns):
elem.tag = elem.tag[nsl:]
# example (import ElementTree as ET)
elem = ET.fromstring(some_xml_string)
remove_namespace(elem, u'http://earth.google.com/kml/2.0')