Method refactored from several dashboard projects including solum,
cerberus and sticks. Inclusion in oslo.utils.importutils will enable
remove the duplicated code and entire class in projects that only
include this one method.
Replaced original RuntimeError exception with ImportError to be
consistent with current oslo.utils library.
Change-Id: I85cb9cc0d9d58bc248cce3048b730bd387f48936