code: def save_file(self, filename, text):
          
          _defaultdir = self.DEFAULTDIR
          try:
              if not filename.endswith('.py'):
                  filename += '.py'
              try:
                  self.DEFAULTDIR = (
                      'init_' + hydpy.pub.timegrids.sim.lastdate.to_string('os'))
              except AttributeError:
                  pass
              path = os.path.join(self.currentpath, filename)
              with open(path, 'w', encoding="utf-8") as file_:
                  file_.write(text)
          except BaseException:
              objecttools.augment_excmessage(
                  'While trying to write the conditions file `%s`'
                  % filename)
          finally:
              self.DEFAULTDIR = _defaultdir
docs: Save the given text under the given condition filename and the
          current path.
  
          If the current directory is not defined explicitly, the directory
          name is constructed with the actual simulation end date.  If
          such an directory does not exist, it is created immediately.