code: def import_module(module, pass_errors=False):
      
      frm = module.split('.')
      try:
          m = __import__(module, fromlist=[frm[1]])
          return m
      except ImportError as e:
          if pass_errors:
              return None
          else:
              print(traceback.format_exc())
              return None
      except Exception as e:
          print(traceback.format_exc())
          return None
docs: Function imports a module given module name
  
      Args
      ----
      module (string): the module name
      pass_errors(boolean): the switch for function
      to skip errors or not.
  
      Returns
      -------
      module (module): the module object.
  
      Raises
      ------
      exception (Exception): any kind of exceptions during importing.
      import_error(ImportError): import errors during importing.
  
      Note:
      pass_errors switch will not pass any errors other than ImportError