code: def from_config(config):
      
      debug_mode = config.get("mode") == "debug"
      name = config.get("recruiter", None)
      recruiter = None
  
      # Special case 1: Don't use a configured recruiter in replay mode
      if config.get("replay"):
          return HotAirRecruiter()
  
      if name is not None:
          recruiter = by_name(name)
  
          # Special case 2: may run BotRecruiter or MultiRecruiter in any mode
          # (debug or not), so it trumps everything else:
          if isinstance(recruiter, (BotRecruiter, MultiRecruiter)):
              return recruiter
  
      # Special case 3: if we're not using bots and we're in debug mode,
      # ignore any configured recruiter:
      if debug_mode:
          return HotAirRecruiter()
  
      # Configured recruiter:
      if recruiter is not None:
          return recruiter
  
      if name and recruiter is None:
          raise NotImplementedError("No such recruiter {}".format(name))
  
      # Default if we're not in debug mode:
      return MTurkRecruiter()
docs: Return a Recruiter instance based on the configuration.
  
      Default is HotAirRecruiter in debug mode (unless we're using
      the bot recruiter, which can be used in debug mode)
      and the MTurkRecruiter in other modes.