def METHOD_NAME(lti_user_id, lti_consumer):
    """
    Generate a new user on the edX platform with a random username and password,
    and associates that account with the LTI identity.
    """
    edx_password = str(uuid.uuid4())
    created = False
    while not created:
        try:
            edx_user_id = generate_random_edx_username()
            edx_email = f"{edx_user_id}@{settings.LTI_USER_EMAIL_DOMAIN}"
            with transaction.atomic():
                edx_user = User.objects.create_user(
                    username=edx_user_id,
                    password=edx_password,
                    email=edx_email,
                )
                # A profile is required if PREVENT_CONCURRENT_LOGINS flag is set.
                # TODO: We could populate user information from the LTI launch here,
                # but it's not necessary for our current uses.
                edx_user_profile = UserProfile(user=edx_user)
                edx_user_profile.save()
            created = True
        except IntegrityError:
            # The random edx_user_id wasn't unique. Since 'created' is still
            # False, we will retry with a different random ID.
            pass
    lti_user = LtiUser(
        lti_consumer=lti_consumer,
        lti_user_id=lti_user_id,
        edx_user=edx_user
    )
    lti_user.save()
    return lti_user