code: def generate_machine_id(new=False,
                          destination_file=constants.machine_id_file):
      
      machine_id = None
      machine_id_file = None
      logging_name = 'machine-id'
  
      if os.path.isfile(destination_file) and not new:
          logger.debug('Found %s', destination_file)
          with open(destination_file, 'r') as machine_id_file:
              machine_id = machine_id_file.read()
      else:
          logger.debug('Could not find %s file, creating', logging_name)
          machine_id = str(uuid.uuid4())
          logger.debug("Creating %s", destination_file)
          write_to_disk(destination_file, content=machine_id)
  
      return str(machine_id).strip()
docs: Generate a machine-id if /etc/insights-client/machine-id does not exist