code: def write(scope, filename, lines, mode=['a']):
      
      with open(filename[0], mode[0]) as fp:
          fp.writelines(['%s\n' % line.rstrip() for line in lines])
      return True
docs: Writes the given string into the given file.
      The following modes are supported:
  
        - 'a': Append to the file if it already exists.
        - 'w': Replace the file if it already exists.
  
      :type  filename: string
      :param filename: A filename.
      :type  lines: string
      :param lines: The data that is written into the file.
      :type  mode: string
      :param mode: Any of the above listed modes.