code: def groups(self, groups):
      groups = (
          groups
          if isinstance(groups, list)
          else [groups]
          if isinstance(groups, int)
          else None
      )
  
      if not isinstance(groups, list):
          raise TypeError(
              "expected groups to be an integer or a list of integers"
          )
      if len(groups) == 0:
          raise ValueError(
              "expected groups to be an integer or a list of "
              "one or more integers"
          )
  
      for group in groups:
          if not isinstance(group, int):
              raise TypeError("expected entry to be an integer")
  
          if group <= 0:
              raise ValueError(
                  "expected entry to be a non-negative integer"
              )
  
      self._locale["grouping"] = groups
      return self
  
imports: import collections
label_desc: Use image node_id 20 for calling the Format obj's underlying member method code with example usage: obj.groups(groups) and returns: self