def _contracted(self, id=None): if id is None: return Party.contracted(self.db) else: return Party.contracted(self.db).filter_by(id=id).first()