def METHOD_NAME(self, file_path, file_type, flag, contents):
    if file_type == "txt":
        with open(file_path, flag) as f:
            f.write(contents)
    else:
        print("flag ", flag, " not support yet!")