code: def write_to_filepath(content, filepath, encoding='utf-8', mode='w', group_writeable=False):
      
      par_dir = os.path.split(filepath)[0]
      if not os.path.exists(par_dir):
          os.makedirs(par_dir)
      if group_writeable:
          with open_for_group_write(filepath, mode=mode, encoding=encoding) as fo:
              fo.write(content)
      else:
          with codecs.open(filepath, mode=mode, encoding=encoding) as fo:
              fo.write(content)
docs: Writes `content` to the `filepath` Creates parent directory
      if needed, and uses the specified file `mode` and data `encoding`.
      If `group_writeable` is True, the output file will have permissions to be
          writable by the group (on POSIX systems)