'How to check if an existing specific user (say techxhelp) is logged in and then logout that specific user in django?

I want to do something like this in views.

This is not a perfect code. I am just giving an example of what is my requirement.

def home(request):
    if request.user.techxhelp is_logged_in:
            logout(techxhelp)
    else:
            pass

I tried searching Google and different sites but I found nothing. If anyone knows the solution, I shall be very thankful.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source