title: Session windows in Apache Beam with python
body: <p>I have a stream of user events. I've mapped them into KV{ userId, event }, and assigned timestamps.</p>
  
  <p>This is to run in streaming mode. I would like to have be able to create the following input-output result:</p>
  
  <p>session window gap=1</p>
  
  <ul>
  <li>input: <code>user=1, timestamp=1, event=a</code></li>
  <li>input: <code>user=2, timestamp=2, event=a</code></li>
  <li>input: <code>user=2, timestamp=3, event=a</code></li>
  <li>input: <code>user=1, timestamp=2, event=b</code></li>
  <li>time: <code>lwm=3</code></li>
  <li>output: <code>user=1, [ { event=a, timestamp=1 }, { event=b, timestamp=2 } ]</code></li>
  <li>time: <code>lwm=4</code></li>
  <li>output: <code>user=2, [ { event=a, timestamp=2 }, { event=a, timestamp=3 } ]</code></li>
  </ul>
  
  <p>So that I can write my function to reduce thee list of events in the session window for the user as well as the start and end time of the session window.</p>
  
  <p>How do I write this? (If you answer; "look at the examples", it's not a valid answer, because they never feed the list of events into the reducer with the window as a parameter)</p>