code: def collections_display(value, level):
      
      is_dict = isinstance(value, dict)
      is_set = isinstance(value, set)
  
      # Get elements
      if is_dict:
          elements = iteritems(value)
      else:
          elements = value
  
      # Truncate values
      truncate = False
      if level == 1 and len(value) > 10:
          elements = islice(elements, 10) if is_dict or is_set else value[:10]
          truncate = True
      elif level == 2 and len(value) > 5:
          elements = islice(elements, 5) if is_dict or is_set else value[:5]
          truncate = True
  
      # Get display of each element
      if level <= 2:
          if is_dict:
              displays = [value_to_display(k, level=level) + ':' +
                          value_to_display(v, level=level)
                          for (k, v) in list(elements)]
          else:
              displays = [value_to_display(e, level=level)
                          for e in elements]
          if truncate:
              displays.append('...')
          display = ', '.join(displays)
      else:
          display = '...'
  
      # Return display
      if is_dict:
          display = '{' + display + '}'
      elif isinstance(value, list):
          display = '[' + display + ']'
      elif isinstance(value, set):
          display = '{' + display + '}'
      else:
          display = '(' + display + ')'
  
      return display
docs: Display for collections (i.e. list, set, tuple and dict).