code: def user_with_name(self, given_name=None, sn=None):
          
          results = []
  
          if sn and not given_name:
              results = User.objects.filter(last_name=sn)
          elif given_name:
              query = {'first_name': given_name}
              if sn:
                  query['last_name'] = sn
              results = User.objects.filter(**query)
  
              if len(results) == 0:
                  # Try their first name as a nickname
                  del query['first_name']
                  query['nickname'] = given_name
                  results = User.objects.filter(**query)
  
          if len(results) == 1:
              return results.first()
  
          return None
docs: Get a unique user object by given name (first/nickname and last).