code: def add_parameter_to_group(self, parameter, group_name):
          
          groups = self.metadata \
              .setdefault("AWS::CloudFormation::Interface", {}) \
              .setdefault("ParameterGroups", [])
  
          if isinstance(parameter, BaseAWSObject):
              parameter = parameter.title
  
          # Check if group_name already exists
          existing_group = None
          for group in groups:
              if group["Label"]["default"] == group_name:
                  existing_group = group
                  break
  
          if existing_group is None:
              existing_group = {
                  "Label": {"default": group_name},
                  "Parameters": [],
              }
              groups.append(existing_group)
  
          existing_group["Parameters"].append(parameter)
  
          return group_name
docs: Add a parameter under a group (created if needed).
          :type parameter: str or Parameter
          :type group_name: str