How to remove characters of a string inside of the parenthesis only from the last position with regex?

I am trying to remove the characters inside of parenthesis from a string but only from the last position. Suppose I have a string

str = I have a (bad) dream (not : funny)

So I want to remove only the last part which is (not : funny). My expected output is -

expected_str = I have a (bad) dream

I am using python and the regex is -


The problem is, this regex removes all parenthesis and the characters inside of it. the output is -

not_expected_str = I have a dream

can anyone tell me how can I get the expected string?

How many English words
do you know?
Test your English vocabulary size, and measure
how many words do you know
Online Test
Powered by Examplum