The hostname field in the API response should have the name of the device. Looks like this should do it:
from lm import lm
collectors = {x.id:x for x in lm.get_collector_list(size=1000).items}
for id, collector in collectors.items():
if collector.description != collector.hostname:
result = lm.update_collector_by_id(id,{"description": collector.hostname, "collectorGroupId": collector.collector_group_id})
print(f"Collector {id}\n\tOld description: {collector.description}\n\tNew description: {result.description}")