#NEWLINE# def parse_nested_keys( string ) : #NEWLINE# #INDENT# ( k , ks ) = re . compile ( '^(.*?)((?:\\[.*?\\])*)$' ) . match ( string ) . groups ( ) #NEWLINE# if ( not ks ) : #NEWLINE# #INDENT# return [ k ] #NEWLINE# #UNINDENT# keys = re . compile ( '\\[(.*?)\\]' ) . findall ( ks ) #NEWLINE# return ( [ k ] + keys )