def _n_rectangles(obj):
    '''
    Calculate the total number of rectangles with respect to
    the type of the object
    '''
    return sum(_total_rectangles(neu) for neu in obj.neurites) \
        if hasattr(obj, 'neurites') else _total_rectangles(obj)
Calculate the total number of rectangles with respect to
    the type of the object