Swapping materials

Hi all!,
It could be a simple task, but im trying to set up a script that runs trough the selected geometry and its children to look for a specific Material (mat_1) and replace it with another (mat_2). With either MEL or Python.
If someone has a solution to this it would be great! Thanks

Im not a TD but i have a script here that does select materials by selected face.
Maybe that does help to get you started.

import maya.cmds as mc
# select object or face
b = mc.ls(sl=1)[0].split("[")[0] # remember a token for comparison below
mc.hyperShade(smn=1) # that will select the shader
s = mc.ls(sl=1)[0] # remember the selected shader
sg = mc.listConnections(s+".oc", s=0, d=1)[0] # figure out the shading group
# select the faces of the same object with same shader attached
l = []
for o in mc.sets(sg, q=1):
if b not in o: continue
l.append(o)
mc.select(l)​