code: def tokenize(s):
      r
      if s is None:
          return
      tokens = (re.sub(r'\\(\\|\.)', r'\1', m.group(0))
                for m in re.finditer(r'((\\.|[^.\\])*)', s))
      ## an empty string superfluous token is added after all non-empty token
      for token in tokens:
          if len(token) != 0:
              next(tokens)
          yield token
docs: r"""Returns an iterable through all subparts of string splitted by '.'
  
      So:
  
          >>> list(tokenize('foo.bar.wiz'))
          ['foo', 'bar', 'wiz']
  
      Contrary to traditional ``.split()`` method, this function has to
      deal with any type of data in the string. So it actually
      interprets the string. Characters with meaning are '.' and '\'.
      Both of these can be included in a token by quoting them with '\'.
  
      So dot of slashes can be contained in token:
  
          >>> print('\n'.join(tokenize(r'foo.dot<\.>.slash<\\>')))
          foo
          dot<.>
          slash<\>
  
      Notice that empty keys are also supported:
  
          >>> list(tokenize(r'foo..bar'))
          ['foo', '', 'bar']
  
      Given an empty string:
  
          >>> list(tokenize(r''))
          ['']
  
      And a None value:
  
          >>> list(tokenize(None))
          []