code: def GetUser(self, sid=None, uid=None, username=None):
      
      if sid:
        for user in self.users:
          if user.sid == sid:
            return user
        return None
      if uid:
        for user in self.users:
          if user.uid == uid:
            return user
      if username:
        for user in self.users:
          if user.username == username:
            # Make sure we aren't combining different uids if we know them
            # user.uid = 0 is the default, which makes this more complicated.
            if uid and user.uid and user.uid != uid:
              return None
            else:
              return user
docs: Retrieve a User based on sid, uid or username.
  
      On windows we first get a SID and use it to find the username.  We want to
      avoid combining users with name collisions, which occur when local users
      have the same username as domain users (something like Admin is particularly
      common).  So if a SID is provided, don't also try to match by username.
  
      On linux we first get a username, then use this to find the UID, so we want
      to combine these records or we end up with multiple partially-filled user
      records.
  
      TODO(user): this won't work at all well with a query for uid=0 because
      that is also the default for User objects that don't have uid
      set.
  
      Args:
        sid: Windows user sid
        uid: Linux/Darwin user id
        username: string
  
      Returns:
        rdf_client.User or None