'Loads the User model object from the database or creates it if it
doesn\'t exist. Also populates the fields, subject to
AUTH_LDAP_ALWAYS_UPDATE_USER.'

def _get_or_create_user(self, force_populate=False):

    save_user = False
    username = self.backend.ldap_to_django_username(self._username)
    (self._user, created) = self.backend.get_or_create_user(username, self)
    self._user.ldap_user = self
    self._user.ldap_username = self._username
    should_populate = (force_populate or self.settings.ALWAYS_UPDATE_USER or created)
    if created:
        logger.debug('Created    Django    user    %s', username)
        self._user.set_unusable_password()
        save_user = True
    if should_populate:
        logger.debug('Populating    Django    user    %s', username)
        self._populate_user()
        save_user = True
    if self.settings.MIRROR_GROUPS:
        self._mirror_groups()
    if should_populate:
        signal_responses = populate_user.send(self.backend.__class__, user=self._user, ldap_user=self)
        if (len(signal_responses) > 0):
            save_user = True
    if save_user:
        self._user.save()
    if (should_populate and hasattr(self._user, 'get_profile')):
        self._populate_and_save_user_profile()
