code: def find_insertion_line(self, code):
          
          match = re.search(r'^(def|class)\s+', code)
          if match is not None:
              code = code[:match.start()]
          try:
              pymodule = libutils.get_string_module(self.project, code)
          except exceptions.ModuleSyntaxError:
              return 1
          testmodname = '__rope_testmodule_rope'
          importinfo = importutils.NormalImport(((testmodname, None),))
          module_imports = importutils.get_module_imports(self.project,
                                                          pymodule)
          module_imports.add_import(importinfo)
          code = module_imports.get_changed_source()
          offset = code.index(testmodname)
          lineno = code.count('\n', 0, offset) + 1
          return lineno
docs: Guess at what line the new import should be inserted