def get_current_categories(request, object):
    if object and object.content_type == "category":
        parents = object.get_parents()
        current_categories = [object]
        current_categories.extend(parents)
    elif object and object.content_type == "product":
        current_categories = []
        category = object.get_current_category(request)
        while category:
            current_categories.append(category)
            category = category.parent
    else:
        current_categories = []

    return current_categories
Test if the IP string is a hostmask (rather than a netmask).
dataset/ETHPy150Open diefenbach/django-lfs/lfs/core/utils.py/get_current_categories--crossover with--dataset/ETHPy150Open anandology/pyjamas/pyjs/src/pyjs/lib/ipaddr.py/IPv4Network._is_hostmask