code: def to_args(s):
      
      args = []
      kwargs = {}
      state = 'arg'
      for token in to_tokens(s):
          if state == 'arg':
              if token.is_key:
                  key = token.value
                  state = 'value'
              else:
                  args.append(token.value)
          elif state == 'key':
              if not token.is_key:
                  raise ExpectingKey(token.value)
              key = token.value
              if key in kwargs:
                  raise DuplicateKey(key)
              state = 'value'
          elif state == 'value':
              if token.is_key:
                  raise ConsecutiveKeys(token.value)
              kwargs[key] = token.value
              state = 'key'
  
      if state == 'value':
          raise IncompleteKeyValue(key)
  
      return args, kwargs
docs: parse a string into args and kwargs
  
          the input is a blank-delimited set of tokens, which may be grouped
          as strings (tick or double tick delimited) with embedded blanks.
          a non-string equal (=) acts as a delimiter between key-value pairs.
  
          the initial tokens are treated as args, followed by key-value pairs.
  
          Example:
  
              one 'two three' four=5 six='seven eight'
  
              parses to:
  
              args = ['one', 'two three']
              kwargs = {'four': 5, 'six': 'seven eight'}
  
          Return:
  
              args as list
              kwargs as dict
  
          Notes:
  
              1. Does not enforce args and keywords as valid python.
  
              2. String delimiters can be escaped (\) within strings.
  
              3. Key-value delimiters (=) can be surrounded by blanks.
  
              4. Non-string integer kwarg values will be int; all other
                 values are str.
  
              5. Designed for functionality, not speed