def _safe_isinstance(obj, module, class_name):
 return ((module in sys.modules) and isinstance(obj, getattr(import_module(module), class_name)))

def _safe_isinstance ( obj , module , class_name ) : return ( ( module in sys . modules ) and isinstance ( obj , getattr ( import_module ( module ) , class_name ) ) )
checks if obj is an instance of module .