Returns length of the content in this element.

    Return value is not correct but it is **good enough***.

def text_length(elem):
    """Returns length of the content in this element.

    Return value is not correct but it is **good enough***.
    """

    if not elem:
        return 0

    value = elem.value()

    try:
        value = len(value)
    except:
        value = 0

    try:
        for a in elem.elements:
            value += len(a.value())
    except:
        pass

    return value