def _leave(self):
    self.log.debug(f'Leaving {self}.')
    self.on_leave()
    try:
        self.validate_on_leave()
    except ValidationError:
        raise AbortMove
    if self.close_pages_on_leave:
        for page in self.pages.values():
            page.close()
    if (self is self.parent.last_member):
        self.parent._leave()
def _leave(self):
    self.log.debug(f'Leaving {self}.')
    self.on_leave()
    try:
        self.validate_on_leave()
    except ValidationError:
        raise AbortMove
    if self.close_pages_on_leave:
        for page in self.pages.values():
            page.close()
    if (self is self.parent.last_member):
        self.parent._leave()