docs: def split(self, maxsplit=None, dequote=True):
          """
          Generator for the words of the string
  
          :param maxsplit: perform at most maxsplit splits;
              if None, do not limit the number of splits
          :param dequote: remove quotes and escape characters once consumed
          """
  
          class Word(object):
              """
              A None-or-str object which can always be appended to.
              Similar to a defaultdict but with only a single value.
              """
  
              def __init__(self):
                  self.value = None
  
              @property
              def valid(self):
                  return self.value is not None
  
              def append(self, s):
                  if self.value is None:
                      self.value = s
                  else:
                      self.value += s
  
          num_splits = 0
          word = Word()
          while True:
              ch = self.stream.read(1)
              if not ch:
                  # EOF
                  if word.valid:
                      yield word.value
  
                  return
  
              if (not self.escaped and
                      self.envs is not None and
                      ch == '$' and
                      self.quotes != self.SQUOTE):
                  while True:
                      # Substitute environment variable
                      braced = False
                      varname = ''
                      while True:
                          ch = self.stream.read(1)
                          if varname == '' and ch == '{':
                              braced = True
                              continue
  
                          if not ch:
                              # EOF
                              break
  
                          if braced and ch == '}':
                              break
  
                          if not ch.isalnum() and ch != '_':
                              break
  
                          varname += ch
  
                      try:
                          word.append(self.envs[varname])
                      except KeyError:
                          pass
  
                      # Check whether there is another envvar
                      if ch != '$':
                          break
  
                  if braced and ch == '}':
                      continue
  
                  # ch now holds the next character
  
              # Figure out what our quoting/escaping state will be
              # after this character
              is_escaped = self.escaped
              ch_unless_consumed = self._update_quoting_state(ch)
  
              if dequote:
                  # If we just processed a quote or escape character,
                  # and were asked to dequote the string, consume it now
                  ch = ch_unless_consumed
  
              # If word-splitting has been requested, check whether we are
              # at a whitespace character
              may_split = maxsplit != 0 and (maxsplit is None or
                                             num_splits < maxsplit)
              at_split = may_split and (self.quotes is None and
                                        not is_escaped and
                                        ch.isspace())
              if at_split:
                  # It is time to yield a word
                  if word.valid:
                      num_splits += 1
                      yield word.value
  
                  word = Word()
              else:
                  word.append(ch)