code: def generate(
      cls, code_lines, change_count, previous_file_modification=None
  ):
      if (
          previous_file_modification is not None
          and random.random() > 0.5
      ):
          # We want to keep the previous modifications in some cases to make
          # more complex parser issues visible.
          code_lines = previous_file_modification.apply(code_lines)
          added_modifications = (
              previous_file_modification.modification_list
          )
      else:
          added_modifications = []
      return cls(
          added_modifications
          + list(
              cls._generate_line_modifications(code_lines, change_count)
          ),
          # work with changed trees more than with normal ones.
          check_original=random.random() > 0.8,
      )
  
imports: from __future__ import print_function
  import logging
  import sys
  import os
  import random
  import pickle
  import parso
  from parso.utils import split_lines
  from test.test_diff_parser import _check_error_leaves_nodes
label_desc: Use image node_id 1 for calling the FileModification obj's underlying member method code with example usage: obj.generate(cls, code_lines, change_count, previous_file_modification) and returns: cls