Get user.organisations subresouces

def active_user_organisations_resource(doc):
    """Get user.organisations subresouces"""
    if doc.get('type') == 'user' and doc.get('state') != 'deactivated':
        for org_id, resource in doc.get('organisations', {}).items():
            if resource['state'] != 'deactivated':
                resource['id'] = org_id
                resource['user_id'] = doc['_id']
                yield [doc['_id'], org_id], resource