<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _pretty_xml(xml_string):
 """ Common function to produce pretty xml string from an input xml_string. This function is NOT intended to be used in major code paths since it uses the minidom to produce the prettified xml and that uses a lot of memory """


    result_dom = minidom.parseString(xml_string)
    pretty_result = result_dom.toprettyxml(indent='  ')

    # remove extra empty lines
    return re.sub(r'>( *[\r\n]+)+( *)<', r'>\n\2<', pretty_result)