code: def category(self) -> Optional[str]:
          '''Determine the category of existing statement'''
          if self.statements:
              if self.statements[-1][0] == ':':
                  # a hack. ... to avoid calling isValid recursively
                  def validDirective():
                      if not self.values:
                          return True
                      if self.values[-1].strip().endswith(','):
                          return False
                      try:
                          compile(
                              'func(' + ''.join(self.values) + ')',
                              filename='<string>',
                              mode='eval')
                      except Exception:
                          return False
                      return True
  
                  if validDirective() and self._action is not None:
                      return 'script'
                  return 'directive'
              return 'statements'
          return Nonf category(self) -> Optional[str]:
          '''Determine the category of existing statement'''
          if self.statements:
              if self.statements[-1][0] == ':':
                  # a hack. ... to avoid calling isValid recursively
                  def validDirective():
                      if not self.values:
                          return True
                      if self.values[-1].strip().endswith(','):
                          return False
                      try:
                          compile(
                              'func(' + ''.join(self.values) + ')',
                              filename='<string>',
                              mode='eval')
                      except Exception:
                          return False
                      return True
  
                  if validDirective() and self._action is not None:
                      return 'script'
                  return 'directive'
              return 'statements'
          return None
docs: Determine the category of existing statement