def _alias_id(self, primary_id, equivalent_id):
pkg_name = primary_id.get_identifier_namespace().split('<STR_LIT:.>')[<NUM_LIT:0>]<EOL>obj_name = primary_id.get_identifier_namespace().split('<STR_LIT:.>')[<NUM_LIT:1>]<EOL>collection = JSONClientValidated(pkg_name,<EOL>collection=obj_name,<EOL>runtime=self._runtime)<EOL>collection.find_one({'<STR_LIT>': ObjectId(primary_id.get_identifier())})  <EOL>collection = JSONClientValidated('<STR_LIT:id>',<EOL>collection=pkg_name + '<STR_LIT>',<EOL>runtime=self._runtime)<EOL>try:<EOL><INDENT>result = collection.find_one({'<STR_LIT>': {'<STR_LIT>': [str(equivalent_id)]}})<EOL><DEDENT>except errors.NotFound:<EOL><INDENT>pass<EOL><DEDENT>else:<EOL><INDENT>result['<STR_LIT>'].remove(str(equivalent_id))<EOL>collection.save(result)<EOL><DEDENT>try:<EOL><INDENT>id_map = collection.find_one({'<STR_LIT>': str(primary_id)})<EOL><DEDENT>except errors.NotFound:<EOL><INDENT>collection.insert_one({'<STR_LIT>': str(primary_id), '<STR_LIT>': [str(equivalent_id)]})<EOL><DEDENT>else:<EOL><INDENT>id_map['<STR_LIT>'].append(str(equivalent_id))<EOL>collection.save(id_map)<EOL><DEDENT>
Adds the given equivalent_id as an alias for primary_id if possible