code: def RegisterUtility(utility_name, version_mapping=None):
    
    def IsFunctionOrMethod(member):
      """Determines if given member is a function or method.
  
      These two are used in combination to ensure that inspect finds all of a
      given utility class's methods in both Python 2 and 3.
  
      Args:
        member: object that is a member of a class, to be determined whether it is
          a function or method.
  
      Returns:
        A boolean that is True if the provided member is a function or method, or
        False if it isn't.
      """
      return inspect.isfunction(member) or inspect.ismethod(member)
  
    def MethodDecorator(utility_method, version):
      """Decorates a method in the utility class."""
      registry_name = ('%s/%s' % (utility_name, version) if version
                       else utility_name)
      @wraps(utility_method)
      def Wrapper(*args, **kwargs):
        AddToUtilityRegistry(registry_name)
        return utility_method(*args, **kwargs)
      return Wrapper
  
    def ClassDecorator(cls):
      """Decorates a utility class."""
      for name, method in inspect.getmembers(cls, predicate=IsFunctionOrMethod):
        # Public methods of the class will have the decorator applied.
        if not name.startswith('_'):
          # The decorator will only be applied to unbound methods; this prevents
          # it from clobbering class methods. If the attribute doesn't exist, set
          # None for PY3 compatibility.
          if not getattr(method, '__self__', None):
            setattr(cls, name, MethodDecorator(
                method, version_mapping.get(name) if version_mapping else None))
      return cls
  
    return ClassDecorator
docs: Decorator that registers a class with the given utility name.
  
    This will only register the utilities being used if the UtilityRegistry is
    enabled. Note that only the utility class's public methods will cause the
    utility name to be added to the registry.
  
    Args:
      utility_name: A str specifying the utility name associated with the class.
      version_mapping: A dict containing optional version strings to append to the
      utility string for individual methods; where the key is the method name and
      the value is the text to be appended as the version.
  
    Returns:
      The decorated class.