title: How to use a custom function in max(x, key=custom_function) function?
body: <p>I have a custom data type, say: <code>mytime</code>, which represent hours and minutes, such as 29:45, it is 29 hours and 45 minutes.</p>
  
  <p>I want to use <code>max</code> built-in function to find the item in a list of lists, whose sum of its elements is the greatest, where all lists contain values of <code>mytime</code> type.</p>
  
  <pre><code>x = [[a, b], [c, d]]
  </code></pre>
  
  <p>a,b,c,d are of <code>mytime</code> type.</p>
  
  <pre><code>max(x, key=sum) 
  </code></pre>
  
  <p>won't work here, because a,b,c,d, are not integers.</p>
  
  <p>If I type <code>a + b</code> at python command line, I get the sum of these two time values, result is of <code>mytime</code> type, without any errors.</p>
  
  <p>How do I use <code>max</code> function here?</p>