#NEWLINE# def expand_record( record , separator = '.' ) : #NEWLINE# #INDENT# 'Expand record represented as dict object by treating keys as key paths separated by\n    `separator`, which is by default ``.``. For example: ``{ "product.code": 10 }`` will become\n    ``{ "product" = { "code": 10 } }``\n\n    See :func:`brewery.collapse_record` for reverse operation.\n    ' #NEWLINE# result = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# for ( key , value ) in record . items ( ) : #NEWLINE# #INDENT# current = result #NEWLINE# path = key . split ( separator ) #NEWLINE# for part in path [ : ( - 1 ) ] : #NEWLINE# #INDENT# if ( part not in current ) : #NEWLINE# #INDENT# current [ part ] = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# #UNINDENT# current = current [ part ] #NEWLINE# #UNINDENT# current [ path [ ( - 1 ) ] ] = value #NEWLINE# #UNINDENT# return result