code: def check_config_mode(self, check_string="", pattern=""):
          
          self.write_channel(self.RETURN)
          # You can encounter an issue here (on router name changes) prefer delay-based solution
          if not pattern:
              output = self._read_channel_timing()
          else:
              output = self.read_until_pattern(pattern=pattern)
          return check_string in output
docs: Checks if the device is in configuration mode or not.
  
          :param check_string: Identification of configuration mode from the device
          :type check_string: str
  
          :param pattern: Pattern to terminate reading of channel
          :type pattern: str