def write_code(self, name, code):
        """
        Writes code to a python file called 'name',
        erasing the previous contents.
        Files are created in a directory specified by gen_dir_name (see function gen_file_path)
        File name is second argument of path
        """
        file_path = self.gen_file_path(name)
        with open(file_path,'w') as f:
            f.write(code)