def freeze(this):
class FrozenPoco(Poco):<EOL><INDENT>def __init__(self, **kwargs):<EOL><INDENT>hierarchy_dict = this.agent.hierarchy.dump()<EOL>hierarchy = create_immutable_hierarchy(hierarchy_dict)<EOL>agent_ = PocoAgent(hierarchy, this.agent.input, this.agent.screen)<EOL>kwargs['<STR_LIT>'] = <NUM_LIT><EOL>kwargs['<STR_LIT>'] = <NUM_LIT:0><EOL>super(FrozenPoco, self).__init__(agent_, **kwargs)<EOL>self.this = this<EOL><DEDENT>def __enter__(self):<EOL><INDENT>return self<EOL><DEDENT>def __exit__(self, exc_type, exc_val, exc_tb):<EOL><INDENT>pass<EOL><DEDENT>def __getattr__(self, item):<EOL><INDENT>return getattr(self.this, item)<EOL><DEDENT><DEDENT>return FrozenPoco()<EOL>
Snapshot current **hierarchy** and cache it into a new poco instance. This new poco instance is a copy from
current poco instance (``self``). The hierarchy of the new poco instance is fixed and immutable. It will be
super fast when calling ``dump`` function from frozen poco. See the example below.

Examples:
    ::

        poco = Poco(...)
        frozen_poco = poco.freeze()
        hierarchy_dict = frozen_poco.agent.hierarchy.dump()  # will return the already cached hierarchy data


Returns:
    :py:class:`Poco <poco.pocofw.Poco>`: new poco instance copy from current poco instance (``self``)