docs: def register(cls, code, name, hash_name=None, hash_new=None):
          """Add an application-specific function to the registry.
  
          Registers a function with the given `code` (an integer) and `name` (a
          string, which is added both with only hyphens and only underscores),
          as well as an optional `hash_name` and `hash_new` constructor for
          hashlib compatibility.  If the application-specific function is
          already registered, the related data is replaced.  Registering a
          function with a `code` not in the application-specific range
          (0x00-0xff) or with names already registered for a different function
          raises a `ValueError`.
  
          >>> import hashlib
          >>> FuncReg.register(0x05, 'md-5', 'md5', hashlib.md5)
          >>> FuncReg.get('md-5') == FuncReg.get('md_5') == 0x05
          True
          >>> hashobj = FuncReg.hash_from_func(0x05)
          >>> hashobj.name == 'md5'
          True
          >>> FuncReg.func_from_hash(hashobj) == 0x05
          True
          >>> FuncReg.reset()
          >>> 0x05 in FuncReg
          False
          """
          if not _is_app_specific_func(code):
              raise ValueError(
                  "only application-specific functions can be registered")
          # Check already registered name in different mappings.
          name_mapping_data = [  # (mapping, name in mapping, error if existing)
              (cls._func_from_name, name,
               "function name is already registered for a different function"),
              (cls._func_from_hash, hash_name,
               "hashlib name is already registered for a different function")]
          for (mapping, nameinmap, errmsg) in name_mapping_data:
              existing_func = mapping.get(nameinmap, code)
              if existing_func != code:
                  raise ValueError(errmsg, existing_func)
          # Unregister if existing to ensure no orphan entries.
          if code in cls._func_hash:
              cls.unregister(code)
          # Proceed to registration.
          cls._do_register(code, name, hash_name, hash_new)