   (goto-char 1)
   (if (search-forward "import " nil t)
 	  (progn (move-beginning-of-line 1)
-			 (while (or (looking-at "import ") (looking-at "from .* import"))
-			   (move-beginning-of-line 2))
+             (while (or (looking-at "import ") (looking-at "from .* import") (looking-at "$"))
+               (python-nav-forward-statement))
 			 (forward-line -1)
-			 (move-end-of-line 1)
-			 (if arg (insert "\nimport ")))
+             (if arg (insert "\nimport ")))
 			 
 	(forward-line)
-	(while (not (looking-at "\n"))
+    (while (not (looking-at "$"))
 	  (forward-line))
 	(insert "\nimport "))
   )

         ("H-d" . my-jump-to-doc-string)
         ("H-t" . my-python-set-test-id)
         ("H-b" . my-add-nose-breakpoint-line)
         ;; ("H-p" . python-params-to-multiple-lines)
         )
  )

  )
(use-package multi-line
  :ensure t
  :bind ("H-a" . multi-line)
)
(use-package elpy
  :ensure t
