code: def generate_file_from_template(self, template, destination):
          
          # We cast the object to a string before passing it on as py3.x
          # will fail on Jinja2 if there are ints/bytes (not strings) in the
          # template which will not allow `env.from_string(template)` to
          # take place.
          templates = str(pkgutil.get_data(__name__, os.path.join(
              'templates', template)))
  
          pretty_params = json.dumps(self.params, indent=4, sort_keys=True)
          self.logger.debug(
              'Rendering %s with params: %s...', template, pretty_params)
          generated = jinja2.Environment().from_string(
              templates).render(self.params)
          self.logger.debug('Writing generated file to %s...', destination)
          self._should_overwrite(destination)
          with open(destination, 'w') as f:
              f.write(generated)
          self.files.append(destination)
docs: Generate a file from a Jinja2 `template` and writes it to
          `destination` using `params`.
  
          `overwrite` allows to overwrite existing files. It is passed to
          the `generate` method.
  
          This is used by the different init implementations to generate
          init scripts/configs and deploy them to the relevant directories.
          Templates are looked up under init/templates/`template`.
  
          If the `destination` directory doesn't exist, it will alert
          the user and exit. We don't want to be creating any system
          related directories out of the blue. The exception to the rule is
          with nssm.
          While it may seem a bit weird, not all relevant directories exist
          out of the box. For instance, `/etc/sysconfig` doesn't necessarily
          exist even if systemd is used by default.