code: def depth_profile(list_, max_depth=None, compress_homogenous=True, compress_consecutive=False, new_depth=False):
      r
      if isinstance(list_, dict):
          list_ = list(list_.values())
      level_shape_list = []
      if not any(map(util_type.is_listlike, list_)):
          return len(list_)
      if False and new_depth:
          pass
      else:
          for item in list_:
              if isinstance(item, dict):
                  item = list(item.values())
              if util_type.is_listlike(item):
                  if max_depth is None:
                      level_shape_list.append(depth_profile(item, None))
                  else:
                      if max_depth >= 0:
                          level_shape_list.append(depth_profile(item, max_depth - 1))
                      else:
                          level_shape_list.append(str(len(item)))
              else:
                  level_shape_list.append(1)
      if compress_homogenous:
          if allsame(level_shape_list):
              dim_ = level_shape_list[0]
              len_ = len(level_shape_list)
              if isinstance(dim_, tuple):
                  level_shape_list = tuple([len_] + list(dim_))
              else:
                  level_shape_list = tuple([len_, dim_])
      if compress_consecutive:
          hash_list = list(map(hash, map(str, level_shape_list)))
          consec_list = group_consecutives(hash_list, 0)
          if len(consec_list) != len(level_shape_list):
              len_list = list(map(len, consec_list))
              cumsum_list = np.cumsum(len_list)
              consec_str = '['
              thresh = 1
              for len_, cumsum in zip(len_list, cumsum_list):
                  value = level_shape_list[cumsum - 1]
                  if len_ > thresh:
                      consec_str += str(value) + '] * ' + str(len_)
                      consec_str += ' + ['
                  else:
                      consec_str += str(value) + ', '
              if consec_str.endswith(', '):
                  consec_str = consec_str[:-2]
              consec_str += ']'
              level_shape_list = consec_str
      return level_shape_list