def extract_config(self, reply, type='<STR_LIT>'):
def remove_read_only(parent):<EOL><INDENT>for child in parent.getchildren():<EOL><INDENT>schema_node = self.get_schema_node(child)<EOL>if schema_node.get('<STR_LIT>') == '<STR_LIT>':<EOL><INDENT>parent.remove(child)<EOL><DEDENT>elif len(child) > <NUM_LIT:0>:<EOL><INDENT>remove_read_only(child)<EOL><DEDENT><DEDENT><DEDENT>config = Config(self, reply)<EOL>remove_read_only(config.ele)<EOL>return config<EOL>
extract_config

        High-level api: Extract config from a rpc-reply of get-config or get
        message.

        Parameters
        ----------

        reply : `RPCReply`
            An instance of RPCReply in ncclient package. It has to be a
            successful reply in order to extract config, since there is no
            config data in an errored reply.

        Returns
        -------

        Config
            An instance of Config, which represents a config state of the
            device.


        Code Example::

            >>> reply = device.nc.get_config(models='openconfig-interfaces')
            >>> assert(reply.ok)
            >>> config1 = device.nc.extract_config(reply)
            >>>
            >>> reply = device.nc.get(models='openconfig-interfaces')
            >>> assert(reply.ok)
            >>> config2 = device.nc.extract_config(reply)
            >>>
            >>> config1 == config2
            True
            >>>