Safe scipy import for target_format.py

Fixes #1038