Complex python list processing
<p>I have a python list made up of usernames and time stamp tuples. Imagine it's like the following:</p>

<pre><code>[(username,datetime_obj),(username,datetime_obj),(username,datetime_obj),(username,datetime_obj),(username,datetime_obj),(username,datetime_obj),(username,datetime_obj),(username,datetime_obj),(username,datetime_obj)]
</code></pre>

<p>Next, imagine the list above has only 3 unique usernames, but that all datetime objects are unique.</p>

<p>What's the most efficient, pythonic way to derive a new list from the one above, which is again made up of tuples and the same usernames, except that next to each username, <strong>the most recent datetime_obj in the list</strong> (for that particular username) is <em>repeatedly</em> attached.</p>

<p>E.g. if starting list was <code>[(sam,1),(sam,7),(sam,8),(jon,4),(mel,9),(mel,2),(mel,10),(jon,3),(jon,6)]</code>, I end up with <code>[(sam,1),(sam,1),(sam,1),(jon,3),(mel,2),(mel,2),(mel,2),(jon,3),(jon,3)]</code>.</p>

<p>I used ints to depict datetime objects in the example above. This was just for simplicity.</p>

<p>Thanks in advance.</p>