def METHOD_NAME(self, context):
    sessions = Session.objects.filter(expire_date__gte=timezone.now())
    uid_list = []
    # Build a list of user ids from that query
    for session in sessions:
        data = session.get_decoded()
        uid = data.get("_auth_user_id", None)
        if uid:
            uid_list.append(uid)
    # Query all logged in users based on id list
    context[self.varname] = (
        models.User.objects.filter(pk__in=uid_list).distinct())
    return ""