Managing line, dimension types with dynamo

Hello,

I am working with big architectural project with a lot of links, mep, structural, families and etc. And as there are so much linked files, imported elements, we have so much line and dimension types that it’s getting hard to work. Is there a way to assign “bad” line types to good ones or purge all unused as it sometimes do not select all elements especially if these types are used in legends