<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def version_by_import(self, module_name):
 # type: (str) ->Dict[str,str] """ This is slow & if running against random code, dangerous Sometimes apps call exit() in import if conditions not met. :param module_name: :return: """

        if not module_name:
            return {}
        try:
            module = __import__(module_name)
        except ModuleNotFoundError:
            # hypothetical module would have to be on python path or execution folder, I think.
            return {}
        except FileNotFoundError:
            return {}

        if hasattr(module, "__version__"):
            version = module.__version__
            return {"module import": version}
        return {}