code: def longest_lines(shape):
      
      lines = []
      for level in set(shape):
          count = 0
          for i in range(len(shape)):
              if shape[i] <= level:
                  count += 1
              elif count:
                  lines.append({'row': level, 'col': i - count + 1, 'len': count})
                  count = 0
          if count:
              lines.append({'row': level, 'col': i - count + 2, 'len': count})
  
      return sorted(lines, key=lambda l: l['row'])
docs: Creates lines from shape
      :param shape:
      :return: list of dictionaries with col,row,len fields