Remove an application-specific function from the registry.

        Unregisters the function with the given `code` (an integer).  If the
        function is not registered, a `KeyError` is raised.  Unregistering a
        function with a `code` not in the application-specific range
        (0x00-0xff) raises a `ValueError`.

        >>> import hashlib
        >>> FuncReg.register(0x05, 'md-5', 'md5', hashlib.md5)
        >>> FuncReg.get('md-5')
        5
        >>> FuncReg.unregister(0x05)
        >>> FuncReg.get('md-5')
        Traceback (most recent call last):
            ...
        KeyError: ('unknown hash function', 'md-5')

def unregister(cls, code):
        """Remove an application-specific function from the registry.

        Unregisters the function with the given `code` (an integer).  If the
        function is not registered, a `KeyError` is raised.  Unregistering a
        function with a `code` not in the application-specific range
        (0x00-0xff) raises a `ValueError`.

        >>> import hashlib
        >>> FuncReg.register(0x05, 'md-5', 'md5', hashlib.md5)
        >>> FuncReg.get('md-5')
        5
        >>> FuncReg.unregister(0x05)
        >>> FuncReg.get('md-5')
        Traceback (most recent call last):
            ...
        KeyError: ('unknown hash function', 'md-5')
        """
        if code in Func:
            raise ValueError(
                "only application-specific functions can be unregistered")
        # Remove mapping to function by name.
        func_names = {n for (n, f) in cls._func_from_name.items() if f == code}
        for func_name in func_names:
            del cls._func_from_name[func_name]
        # Remove hashlib data and mapping to hash.
        hash = cls._func_hash.pop(code)
        if hash.name:
            del cls._func_from_hash[hash.name]