code: def safe_group_name(group_name, group_max_length=100, ellipsis=True):
          
          ellipsis_value = ''
          if ellipsis:
              ellipsis_value = ' ...'
  
          if group_name is not None and len(group_name) > group_max_length:
              # split name by spaces and reset group_name
              group_name_array = group_name.split(' ')
              group_name = ''
              for word in group_name_array:
                  word = u'{}'.format(word)
                  if (len(group_name) + len(word) + len(ellipsis_value)) >= group_max_length:
                      group_name = '{}{}'.format(group_name, ellipsis_value)
                      group_name = group_name.lstrip(' ')
                      break
                  group_name += ' {}'.format(word)
          return group_name
docs: Truncate group name to match limit breaking on space and optionally add an ellipsis.
  
          .. note:: Currently the ThreatConnect group name limit is 100 characters.
  
          Args:
             group_name (string): The raw group name to be truncated.
             group_max_length (int): The max length of the group name.
             ellipsis (boolean): If true the truncated name will have '...' appended.
  
          Returns:
              (string): The truncated group name with optional ellipsis.