def _indent(elem, level=0):
    i = ('\n' + (level * '  '))
    if len(elem):
        if ((not elem.text) or (not elem.text.strip())):
            elem.text = (i + '  ')
        if ((not elem.tail) or (not elem.tail.strip())):
            elem.tail = i
        for elem in elem:
            _indent(elem, (level + 1))
        if ((not elem.tail) or (not elem.tail.strip())):
            elem.tail = i
    elif (level and ((not elem.tail) or (not elem.tail.strip()))):
        elem.tail = i
def _indent(elem, level=0):
    i = ('\n' + (level * '  '))
    if len(elem):
        if ((not elem.text) or (not elem.text.strip())):
            elem.text = (i + '  ')
        if ((not elem.tail) or (not elem.tail.strip())):
            elem.tail = i
        for elem in elem:
            _indent(elem, (level + 1))
        if ((not elem.tail) or (not elem.tail.strip())):
            elem.tail = i
    elif (level and ((not elem.tail) or (not elem.tail.strip()))):
        elem.tail = i