<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def register_instance(self, obj, prefix=''):
 """Create new subdispatcher and register all public object methods on it. To be used in conjunction with the :py:func:`public` decorator (*not* :py:func:`RPCDispatcher.public`). :param obj: The object whose public methods should be made available. :type obj: object :param str prefix: A prefix for the new subdispatcher. """

        dispatch = self.__class__()
        for name, f in inspect.getmembers(
                obj, lambda f: callable(f) and hasattr(f, '_rpc_public_name')):
            dispatch.add_method(f, f._rpc_public_name)

        # add to dispatchers
        self.add_subdispatch(dispatch, prefix)