code: def _legacy_handle_unregistration(config, pconn):
      
      check = get_registration_status(config, pconn)
  
      for m in check['messages']:
          logger.debug(m)
  
      if check['unreachable']:
          # Run connection test and exit
          return None
  
      if check['status']:
          unreg = pconn.unregister()
      else:
          unreg = True
          logger.info('This system is already unregistered.')
      if unreg:
          # only set if unreg was successful
          write_unregistered_file()
          get_scheduler(config).remove_scheduling()
      return unreg
docs: returns (bool): True success, False failure