docs: def run_class(class_name, args=None, properties=None, classpath=None,
                hadoop_conf_dir=None, logger=None, keep_streams=True):
      """
      Run a Java class with Hadoop (equivalent of running ``hadoop
      <class_name>`` from the command line).
  
      Additional ``HADOOP_CLASSPATH`` elements can be provided via
      ``classpath`` (either as a non-string sequence where each element
      is a classpath element or as a ``':'``-separated string).  Other
      arguments are passed to :func:`run_cmd`.
  
      .. code-block:: python
  
        >>> cls = 'org.apache.hadoop.fs.FsShell'
        >>> try: out = run_class(cls, args=['-test', '-e', 'file:/tmp'])
        ... except RunCmdError: tmp_exists = False
        ... else: tmp_exists = True
  
      .. note::
  
        ``HADOOP_CLASSPATH`` makes dependencies available **only on the
        client side**.  If you are running a MapReduce application, use
        ``args=['-libjars', 'jar1,jar2,...']`` to make them available to
        the server side as well.
      """
      if logger is None:
          logger = utils.NullLogger()
      old_classpath = None
      if classpath:
          old_classpath = os.getenv('HADOOP_CLASSPATH', '')
          if isinstance(classpath, basestring):
              classpath = [classpath]
          # Prepend the classpaths provided by the user to the existing
          # HADOOP_CLASSPATH value.  Order matters.  We could work a little
          # harder to avoid duplicates, but it's not essential
          os.environ['HADOOP_CLASSPATH'] = ":".join(
              classpath + old_classpath.split(':', 1)
          )
          logger.debug('HADOOP_CLASSPATH: %r', os.getenv('HADOOP_CLASSPATH'))
      try:
          res = run_cmd(class_name, args, properties,
                        hadoop_conf_dir=hadoop_conf_dir, logger=logger,
                        keep_streams=keep_streams)
      finally:
          if old_classpath is not None:
              os.environ['HADOOP_CLASSPATH'] = old_classpath
      return res