utils.py
def writetextfile(data, filename, path=None):
    """If path is provided, it will make sure the path exists before writing
    the file."""
    if path:
        if not os.path.isdir(path):
            os.makedirs(path)
        filename = os.path.join(path, filename)
    with open(filename, 'w') as f:
        f.writelines(data)
    f.close()
If path is provided, it will make sure the path exists before writing
    the file.
If path is provided, it will make sure the path exists before writing
the file.
If path is provided it will make sure the path exists before writing the file .
def writetextfile(data, filename, path=None):
    if path:
        if not os.path.isdir(path):
            os.makedirs(path)
        filename = os.path.join(path, filename)
    with open(filename, 'w') as f:
        f.writelines(data)
    f.close()
def writetextfile ( data , filename , path = None ) : if path : if not os . path . isdir ( path ) : os . makedirs ( path ) filename = os . path . join ( path , filename ) with open ( filename , 'w' ) as f : f . writelines ( data ) f . close ( )
If path is provided, it will make sure the path exists before writing
the file.
If path is provided it will make sure the path exists before writing the file .
"""If path is provided, it will make sure the path exists before writing
    the file."""
data
filename
path