If current bracket is a closing bracket then pop from stack if it is not empty . If stack is empty then sequence is not balanced .
else : NEW_LINE INDENT if len ( st ) == 0 : NEW_LINE INDENT return False NEW_LINE DEDENT else : NEW_LINE INDENT st . pop ( ) NEW_LINE DEDENT DEDENT