'Map element to unicode character. If it has no children, it\'ll be mapped
to a single char, otherwise mapped as "(X + Y + Z)" where X, Y, Z is
mapping of its children (+ is concatenation).
@param elem: lxml Element
@param tagToCharMap: dict from tag name to unicode char'

def mapTree(self, elem, tagToCharMap):

    children = [child for child in list(elem) if isinstance(child.tag, basestring)]
    thisElem = tagToCharMap[elem.tag]
    if children:
        childrenMap = [self.mapTree(child, tagToCharMap) for child in children]
        return (((thisElem + u'(') + ''.join(childrenMap)) + u')')
    else:
        return thisElem
