Loop over all materials / find material

Hey

What's the best way to get a list of all materials? Assigned/not assigned/scene/non scene/ library etc?

I want to find material by name & assign to geometry.

Regards
Dariusz