def get_current_top_category(request, obj):
    if obj.__class__.__name__.lower() == "product":
        category = obj.get_current_category(request)
    else:
        category = obj

    if category is None:
        return category

    while category.parent is not None:
        category = category.parent

    return category
Initialize the `handler_cls` instance with the given
dataset/ETHPy150Open diefenbach/django-lfs/lfs/catalog/utils.py/get_current_top_category--crossover with--dataset/ETHPy150Open Lawouach/WebSocket-for-Python/ws4py/server/wsgiutils.py/WebSocketWSGIApplication.make_websocket