title: Sorting items using user-defined rule
body: <p>For instance, if I have a list of usernames, lets call this list L1, each username has his/her own profile (not stored in the L1). How should we write the function so that it will sort the usernames based on their actual name, if any usernames are tied for actual name, sort them by usernames. Note, I can get the username of the user by writing <code>username[1]</code>, usernames are unique.</p>
  
  <p>This is what I write:</p>
  
  <pre><code>def username(s1, s2):
  
      if s1 &lt; s2:
          return -1
      elif s1 &gt; s2:
          return 1
      else:
          # How can i sort them by username if they have the same actual name
          return 0
  </code></pre>