def make_immutable(value):
    if isinstance(value, Mapping):
        if isinstance(value, frozendict):
            return value
        return frozendict(((k, make_immutable(v)) for (k, v) in iteritems(value)))
    elif isinstance(value, Set):
        if isinstance(value, frozenset):
            return value
        return frozenset((make_immutable(v) for v in value))
    elif isiterable(value):
        if isinstance(value, tuple):
            return value
        return tuple((make_immutable(v) for v in value))
    else:
        return value
def make_immutable(value):
    if isinstance(value, Mapping):
        if isinstance(value, frozendict):
            return value
        return frozendict(((k, make_immutable(v)) for (k, v) in iteritems(value)))
    elif isinstance(value, Set):
        if isinstance(value, frozenset):
            return value
        return frozenset((make_immutable(v) for v in value))
    elif isiterable(value):
        if isinstance(value, tuple):
            return value
        return tuple((make_immutable(v) for v in value))
    else:
        return value