def add_metadata_comments(self, d, metadata):
if len(metadata) > <NUM_LIT:2>:<EOL><INDENT>string_pairs = metadata[<NUM_LIT:1>:-<NUM_LIT:1>]  <EOL>for sp in string_pairs:<EOL><INDENT>if isinstance(sp.children[<NUM_LIT:0>], Token):<EOL><INDENT>token = sp.children[<NUM_LIT:0>]<EOL>assert token.type == "<STR_LIT>"<EOL>key = token.value<EOL><DEDENT>else:<EOL><INDENT>token = sp.children[<NUM_LIT:0>].children[<NUM_LIT:0>]<EOL>key = token.value<EOL><DEDENT>key = self._mapfile_todict.clean_string(key).lower()<EOL>assert key in d.keys()<EOL>key_comments = self.get_comments(sp.meta)<EOL>d["<STR_LIT>"][key] = key_comments<EOL><DEDENT><DEDENT>return d<EOL>
Any duplicate keys will be replaced with the last duplicate along with comments