'Get the root Group'

def get_root(self):

    root = self
    stack = [self]
    while getattr(root, 'parent', None):
        root = getattr(root, 'parent')
        if (root in stack):
            break
        stack.append(root)
    return root
