docs: def authenticate(self, request, remote_user=None):
          #pylint:disable=arguments-differ
          # Django <=1.8 and >=1.9 have different signatures.
          """
          The ``username`` passed here is considered trusted.  This
          method simply returns the ``User`` object with the given username.
  
          In order to support older Django versions
          (before commit 4b9330ccc04575f9e5126529ec355a450d12e77c), if username
          is None, we will assume request is the ``remote_user`` parameter.
          """
          if not remote_user:
              remote_user = request
          if not remote_user:
              return None
  
          user = None
          username = self.clean_username(remote_user)
          try:
              #pylint:disable=protected-access
              if self.create_unknown_user:
                  defaults = {}
                  if isinstance(request, dict):
                      session_data = request
                      if 'full_name' in session_data:
                          first_name, _, last_name = full_name_natural_split(
                              session_data['full_name'])
                          defaults.update({
                              'first_name': first_name,
                              'last_name': last_name
                          })
                      for key in ('email', 'first_name', 'last_name'):
                          if key in session_data:
                              defaults.update({key: session_data[key]})
                  user, created = UserModel._default_manager.get_or_create(**{
                      UserModel.USERNAME_FIELD: username,
                      'defaults': defaults,
                  })
                  if created:
                      LOGGER.debug("created user '%s' in database.", username)
                      user = self.configure_user(user)
              else:
                  try:
                      user = UserModel._default_manager.get_by_natural_key(
                          username)
                  except UserModel.DoesNotExist:
                      pass
          except DatabaseError as err:
              LOGGER.debug("User table missing from database? (err:%s)", err)
              # We don't have a auth_user table, so let's build a hash in memory.
              for user in six.itervalues(self.users):
                  LOGGER.debug("match %s with User(id=%d, username=%s)",
                      username, user.id, user.username)
                  if user.username == username:
                      LOGGER.debug("found %d %s", user.id, user.username)
                      return user
              # Not found in memory dict
              user = UserModel(
                  id=random.randint(1, (1 << 32) - 1), username=username)
              LOGGER.debug("add User(id=%d, username=%s) to cache.",
                  user.id, user.username)
              self.users[user.id] = user
          return user if self.user_can_authenticate(user) else None