docs: def register_temp_plugin(cls, class_, identifier=None, dist='xblock'):
          """Decorate a function to run with a temporary plugin available.
  
          Use it like this in tests::
  
              @register_temp_plugin(MyXBlockClass):
              def test_the_thing():
                  # Here I can load MyXBlockClass by name.
  
          """
          from mock import Mock
  
          if identifier is None:
              identifier = class_.__name__.lower()
  
          entry_point = Mock(
              dist=Mock(key=dist),
              load=Mock(return_value=class_),
          )
          entry_point.name = identifier
  
          def _decorator(func):                           # pylint: disable=C0111
              @functools.wraps(func)
              def _inner(*args, **kwargs):                # pylint: disable=C0111
                  global PLUGIN_CACHE  # pylint: disable=global-statement
  
                  old = list(cls.extra_entry_points)
                  old_cache = PLUGIN_CACHE
  
                  cls.extra_entry_points.append((identifier, entry_point))
                  PLUGIN_CACHE = {}
  
                  try:
                      return func(*args, **kwargs)
                  finally:
                      cls.extra_entry_points = old
                      PLUGIN_CACHE = old_cache
              return _inner
          return _decorator