<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def printGenericTree(element, level=0, showids=True, labels=False, showtype=True, TYPE_MARGIN=18):
 """ Print nicely into stdout the taxonomical tree of an ontology. Works irrespectively of whether it's a class or property. Note: indentation is made so that ids up to 3 digits fit in, plus a space. [123]1-- [1]123-- [12]12-- <TYPE_MARGIN> is parametrized so that classes and properties can have different default spacing (eg owl:class vs owl:AnnotationProperty) """


    ID_MARGIN = 5

    SHORT_TYPES = {
        "rdf:Property": "rdf:Property",
        "owl:AnnotationProperty": "owl:Annot.Pr.",
        "owl:DatatypeProperty": "owl:DatatypePr.",
        "owl:ObjectProperty": "owl:ObjectPr.",
    }

    if showids:
        _id_ = Fore.BLUE +	\
        "[%d]%s" % (element.id, " " * (ID_MARGIN  - len(str(element.id)))) +  \
            Fore.RESET

    elif showtype:
        _prop = uri2niceString(element.rdftype)
        try:
            prop = SHORT_TYPES[_prop]
        except:
            prop = _prop
        _id_ = Fore.BLUE +	\
        "[%s]%s" % (prop, " " * (TYPE_MARGIN  - len(prop))) + Fore.RESET

    else:
        _id_ = ""

    if labels:
        bestLabel = element.bestLabel(qname_allowed=False)
        if bestLabel:
            bestLabel = Fore.MAGENTA + " (\"%s\")" % bestLabel + Fore.RESET
    else:
        bestLabel = ""

    printDebug("%s%s%s%s" % (_id_, "-" * 4 * level, element.qname, bestLabel))

    # recursion
    for sub in element.children():
        printGenericTree(sub, (level + 1), showids, labels, showtype,
                         TYPE_MARGIN)