title: Append nested list in python based on last value and first value of the lists
body: <p>I have a below python nested list</p>
  
  <pre><code>[[text1, data1, text2][text2, data2, text3][text5, data4, text6][text3, data3, text4]]
  </code></pre>
  
  <p>I would like to convert this to </p>
  
  <pre><code>[[text1, data1, text2, data2, text3, data3, text4][text5,data4,text6]]
  </code></pre>
  
  <p>Basically, if the last value of the first list is the same as first value of any other list, then it should be combined.</p>
  
  <p>Is there a simple way to do it, or I have to loop through the list with a condition and append it?</p>