This is practically equivalent to
for x in search_perms:
ctype, y = x
codename, name = y
or
for x in search_perms:
ctype = x[0]
codename = x[1][0]
name = x[1][1]
i.e., it unpacks the items from search_perms as pairs, then unpacks the second item of each pair as a pair as well.
Example:
>>> d = {"ham": "yes", "spam": "no", "eggs": "please"}
>>> for k, v in d.iteritems():
... print("%s? %s" % (k, v))
...
eggs? please
ham? yes
spam? no
>>> for i, (k, v) in enumerate(d.iteritems()):
... print("question %d: %s? %s" % (i, k, v))
...
question 0: eggs? please
question 1: ham? yes
question 2: spam? no
This works because enumerate(d.iteritems()) generates pairs where each second element is again a pair:
>>> list(enumerate(d.iteritems()))
[(0, ('eggs', 'please')), (1, ('ham', 'yes')), (2, ('spam', 'no'))]