How to evaluate nested boolean/logical expressions in Python?

I'm able to do simple rules but having trouble evaluating complex rules in nested parenthesis.

Here's nested rule definition I'm trying to evaluate:

definition = '((K00925 K00625),K01895) (K00193+K00197+K00194) (K00577+K00578+K00579+K00580+K00581-K00582-K00583+K00584) (K00399+K00401+K00402) (K22480+K22481+K22482,K03388+K03389+K03390,K08264+K08265,K03388+K03389+K03390+K14127+(K14126+K14128,K22516+K00125))'