'Make this feature structure, and any feature structure it
contains, immutable.
:param visited: A set containing the ids of all feature
structures we\'ve already visited while freezing.'

def _freeze(self, visited):

    if (id(self) in visited):
        return
    visited.add(id(self))
    self._frozen = True
    for (fname, fval) in sorted(self._items()):
        if isinstance(fval, FeatStruct):
            fval._freeze(visited)
