This is incorrect.  You either need to disallow ']'s in expressions, or have more complicated parsing logic that matches opened and closed square braces.

    >>> section_header('[ a ]  # ]').group('expression')
    ']  # '
    >>> section_header('[ a : True]  # ]').group('expression')
    'True]  # '
    >>> section_header('[ a : True]  # []').group('expression')
    'True]  # ['
    >>> section_header('[ a ]  # []').group('expression')
    ']  # ['
    >>> section_header('[ a ]').group('expression')
    ''