if middle ends with closing and count of occurrence of closing in middle equals count of occurrence of opening in middle incremented by one,
if ( middle . endswith ( closing ) and middle . count ( closing ) == middle . count ( opening ) + 1 ) :