code: def process_info(pid=None):
      '''Returns a dictionary of system information for the process ``pid``.
  
      It uses the psutil_ module for the purpose. If psutil_ is not available
      it returns an empty dictionary.
  
      .. _psutil: http://code.google.com/p/psutil/
      '''
      if psutil is None:  # pragma    nocover
          return {}
      pid = pid or os.getpid()
      try:
          p = psutil.Process(pid)
      # this fails on platforms which don't allow multiprocessing
      except psutil.NoSuchProcess:  # pragma    nocover
          return {}
      else:
          mem = p.memory_info()
          return {'memory': convert_bytes(mem.rss),
                  'memory_virtual': convert_bytes(mem.vms),
                  'cpu_percent': p.cpu_percent(),
                  'nice': p.nice(),
                  'num_threads': p.num_threads()f process_info(pid=None):
      '''Returns a dictionary of system information for the process ``pid``.
  
      It uses the psutil_ module for the purpose. If psutil_ is not available
      it returns an empty dictionary.
  
      .. _psutil: http://code.google.com/p/psutil/
      '''
      if psutil is None:  # pragma    nocover
          return {}
      pid = pid or os.getpid()
      try:
          p = psutil.Process(pid)
      # this fails on platforms which don't allow multiprocessing
      except psutil.NoSuchProcess:  # pragma    nocover
          return {}
      else:
          mem = p.memory_info()
          return {'memory': convert_bytes(mem.rss),
                  'memory_virtual': convert_bytes(mem.vms),
                  'cpu_percent': p.cpu_percent(),
                  'nice': p.nice(),
                  'num_threads': p.num_threads()}
docs: Returns a dictionary of system information for the process ``pid``.
  
      It uses the psutil_ module for the purpose. If psutil_ is not available
      it returns an empty dictionary.
  
      .. _psutil: http://code.google.com/p/psutil/