def add_node_name(name: str) -> str:
    node_id = self.escape_id(name)
    (nth, suffix) = (1, '')
    while (((node_id + suffix) in self.written_ids) or ((node_id + suffix) in self.node_names)):
        nth += 1
        suffix = ('<%s>' % nth)
    node_id += suffix
    self.written_ids.add(node_id)
    self.node_names[node_id] = name
    return node_id
def add_node_name(name: str) -> str:
    node_id = self.escape_id(name)
    (nth, suffix) = (1, )
    while (((node_id + suffix) in self.written_ids) or ((node_id + suffix) in self.node_names)):
        nth += 1
        suffix = ('<%s>' % nth)
    node_id += suffix
    self.written_ids.add(node_id)
    self.node_names[node_id] = name
    return node_id