code: def stop(self):
          
          consumed_energy = collections.defaultdict(dict)
          if not self.is_running():
              return None
          # cpu-energy-meter expects SIGINT to stop and report its result
          self._measurement_process.send_signal(signal.SIGINT)
          (out, err) = self._measurement_process.communicate()
          assert self._measurement_process.returncode is not None
          if self._measurement_process.returncode:
              logging.debug(
                  "Energy measurement terminated with return code %s",
                  self._measurement_process.returncode)
          self._measurement_process = None
          for line in err.splitlines():
              logging.debug("energy measurement stderr: %s", line)
          for line in out.splitlines():
              line = line.decode('ASCII')
              logging.debug("energy measurement output: %s", line)
              match = re.match(r'cpu(\d+)_([a-z]+)_joules=(\d+\.?\d*)', line)
              if not match:
                  continue
  
              cpu, domain, energy = match.groups()
              cpu = int(cpu)
              energy = Decimal(energy)
  
              consumed_energy[cpu][domain] = energy
          return consumed_energy
docs: Stops the external measurement program and returns the measurement result,
          if the measurement was running.