docs: def _gen(self, optimized, splitstring):
          """Generates a new random object generated from the nonterminal
          Args:
              optimized (bool): mode of operation - if enabled not all
                              CNF rules are included (mitigate O(n^3))
              splitstring (bool): A boolean for enabling or disabling
          Returns:
              str: The generated string
          """
          # Define Dictionary that holds resolved rules
          # (only in form A -> terminals sequence)
          self.resolved = {}
          # First update Resolved dictionary by adding rules
          # that contain only terminals (resolved rules)
          for nt in self.grammar.grammar_nonterminals_map:
              for i in self.grammar.grammar_nonterminals_map[nt]:
                  if self.grammar.grammar_rules[i][0] not in self.resolved\
                          and not isinstance(self.grammar.grammar_rules[i][1], (set, tuple)):
                      if self.grammar.grammar_rules[i][1] != '@empty_set' \
                              and self.grammar.grammar_rules[i][1] in self.grammar.grammar_terminals:
  
                          if splitstring:
                              self.resolved[
                                  self.grammar.grammar_rules[i][0]] = self.grammar.grammar_rules[i][1]
                          else:
                              if self.grammar.grammar_rules[i][1] == '&':
                                  self.resolved[self.grammar.grammar_rules[i][0]] = ' '
                              else:
                                  self.resolved[
                                      self.grammar.grammar_rules[i][0]] = self.grammar.grammar_rules[i][1]
                          # print 'ResolvingA '+self.g.Rules[i][0]+": "+
                          # self.g.Rules[i][1]
                          if self._checkfinal(self.grammar.grammar_rules[i][0]):
                              return self.resolved[self.grammar.grammar_rules[i][0]]
                          if self.grammar.grammar_rules[i][0] not in self.bfs_queue:
                              self.bfs_queue.append(self.grammar.grammar_rules[i][0])
                      if self.grammar.grammar_rules[i][1] == '@empty_set':
                          self.resolved[self.grammar.grammar_rules[i][0]] = ''
                          # print 'ResolvingB '+self.g.Rules[i][0]+": "
                          self.bfs_queue.append(self.grammar.grammar_rules[i][0])
                      if optimized and self._check_self_to_empty(
                              self.grammar.grammar_rules[i][1]):
                          self.resolved[self.grammar.grammar_rules[i][0]] = ''
                          # print 'ResolvingC '+self.g.Rules[i][0]+": "
                          if self.grammar.grammar_rules[i][0] not in self.bfs_queue:
                              self.bfs_queue.append(self.grammar.grammar_rules[i][0])
  
          # Then try to use the rules from Resolved dictionary and check
          # if there is another rule that can be resolved.
          # This should be done in a while loop
          change = 1
          while change:
              change = 0
              if not change:
                  ret = self._check_self_nonterminals(optimized)
                  if ret == 1:
                      change = 1
                  elif ret != 0:
                      return ret
              if not change:
                  while not change and len(self.bfs_queue) > 0:
                      myntr = self.bfs_queue.pop()
                      ret = self._check_self_replicate(myntr)
                      if ret == 1:
                          change = 1
                      elif ret != 0:
                          return ret
                      if optimized and self._check_intemediate(
                              myntr, self.maxstate):
                          change = 1
                          break