def getOperators(self, expression):
    list = {}
    if isinstance(expression, Operator):
        list[expression.name] = expression.category
    if hasattr(expression, 'operands'):
        for p in expression.operands:
            if isinstance(p, Operator):
                list[p.name] = p.category
            elif hasattr(p, 'operands'):
                subList = self.getOperators(p)
                list = {**list, **subList}
    return list
def getOperators(self, expression):
    list = {}
    if isinstance(expression, Operator):
        list[expression.name] = expression.category
    if hasattr(expression, 'operands'):
        for p in expression.operands:
            if isinstance(p, Operator):
                list[p.name] = p.category
            elif hasattr(p, 'operands'):
                subList = self.getOperators(p)
                list = {**list, **subList}
    return list