docs: def get_inventory_temp_file(self, keys=None):
          """
          Context manager which returns the inventory written on a tempfile.
          The tempfile will be deleted as soon as this context manger ends.
  
          Args:
              keys (list of str): Path to the keys that will be used to
                  create groups.
  
          Yields:
              tempfile.NamedTemporaryFile: Temp file containing the inventory
          """
          temp_file = tempfile.NamedTemporaryFile(mode='r+t')
          inventory = self.get_inventory_str(keys)
          LOGGER.debug(
              'Writing inventory to temp file {} \n{}'.format(
                  temp_file.name, inventory
              )
          )
          temp_file.write(inventory)
          temp_file.flush()
          temp_file.seek(0)
          yield temp_file
          temp_file.close()