code: def _getitem(string, depth=0):
      
      out = [""]
      while string:
          char = string[0]
          if depth and (char == ',' or char == '}'):
              return out, string
          if char == '{':
              groups_string = _getgroup(string[1:], depth+1)
              if groups_string is not None:
                  groups, string = groups_string
                  out = [a + g for a in out for g in groups]
                  continue
          if char == '\\' and len(string) > 1:
              string, char = string[1:], char + string[1]
  
          out, string = [a + char for a in out], string[1:]
  
      return out, string
docs: Get an item from the string (where item is up to the next ',' or '}' or the
      end of the string)