def flatten(self, messages, parent_key='<STR_LIT>'):
items = []<EOL>sep = '<STR_LIT:.>'<EOL>for k, v in list(messages.items()):<EOL><INDENT>new_key = "<STR_LIT>".format(parent_key, sep, k) if parent_key else k<EOL>if isinstance(v, collections.MutableMapping):<EOL><INDENT>items.extend(list(self.flatten(v, new_key).items()))<EOL><DEDENT>else:<EOL><INDENT>items.append((new_key, v))<EOL><DEDENT><DEDENT>return dict(items)<EOL>
Flattens an nested array of translations.

The scheme used is:
  'key' => array('key2' => array('key3' => 'value'))
Becomes:
  'key.key2.key3' => 'value'

This function takes an array by reference and will modify it

@type messages: dict
@param messages: The dict that will be flattened

@type parent_key: str
@param parent_key: Current path being parsed, used internally for recursive calls