def RegisterHasher(cls, hasher_class):
    """Registers a hasher class.

    The hasher classes are identified based on their lower case name.

    Args:
      hasher_class (type): class object of the hasher.

    Raises:
      KeyError: if hasher class is already set for the corresponding name.
    """
    hasher_name = hasher_class.NAME.lower()
    if hasher_name in cls._hasher_classes:
      raise KeyError((
          'hasher class already set for name: {0:s}.').format(
              hasher_class.NAME))

    cls._hasher_classes[hasher_name] = hasher_class
Registers a hasher class.

    The hasher classes are identified based on their lower case name.

    Args:
      hasher_class (type): class object of the hasher.

    Raises:
      KeyError: if hasher class is already set for the corresponding name.