def expand_dictionary(record, separator='.'):
 result = {}
 for (key, value) in record.items():
  current = result
  path = key.split(separator)
  for part in path[:(-1)]:
   if (part not in current):
    current[part] = {}
   current = current[part]
  current[path[(-1)]] = value
 return result

def expand_dictionary ( record , separator = '.' ) : result = { } for ( key , value ) in record . items ( ) : current = result path = key . split ( separator ) for part in path [ : ( - 1 ) ] : if ( part not in current ) : current [ part ] = { } current = current [ part ] current [ path [ ( - 1 ) ] ] = value return result
return expanded dictionary: treat keys are paths separated by separator .