def register_method(self, func):
        """
        Register a function to be available as RPC method.

        The given function will be inspected to find external_name, protocol and entry_point values set by the decorator
        @rpc_method.
        :param func: A function previously decorated using @rpc_method
        :return: The name of registered method
        """
        if not getattr(func, 'modernrpc_enabled', False):
            raise ImproperlyConfigured('Error: trying to register {} as RPC method, but it has not been decorated.'
                                       .format(func.__name__))

        # Define the external name of the function
        name = getattr(func, 'modernrpc_name', func.__name__)

        logger.debug('Register RPC method "{}"'.format(name))

        if name.startswith('rpc.'):
            raise ImproperlyConfigured('According to RPC standard, method names starting with "rpc." are reserved for '
                                       'system extensions and must not be used. See '
                                       'http://www.jsonrpc.org/specification#extensions for more information.')

        # Encapsulate the function in a RPCMethod object
        method = RPCMethod(func)

        # Ensure method names are unique in the registry
        existing_method = self.get_method(method.name, ALL, ALL)
        if existing_method is not None:
            # Trying to register many times the same function is OK, because if a method is decorated
            # with @rpc_method(), it could be imported in different places of the code
            if method == existing_method:
                return method.name
            # But if we try to use the same name to register 2 different methods, we
            # must inform the developer there is an error in the code
            else:
                raise ImproperlyConfigured("A RPC method with name {} has already been registered".format(method.name))

        # Store the method
        self._registry[method.name] = method
        logger.debug('Method registered. len(registry): {}'.format(len(self._registry)))

        return method.name
Register a function to be available as RPC method.

        The given function will be inspected to find external_name, protocol and entry_point values set by the decorator
        @rpc_method.
        :param func: A function previously decorated using @rpc_method
        :return: The name of registered method