Freeze python types by turning them into immutable structures.

def freeze(obj):
    '''
    Freeze python types by turning them into immutable structures.
    '''
    if isinstance(obj, dict):
        return ImmutableDict(obj)
    if isinstance(obj, list):
        return ImmutableList(obj)
    if isinstance(obj, set):
        return ImmutableSet(obj)
    return obj