@hybrid_property
def complicated_property(self):
    if 17 <= self.a <= 173:
        return a_complicated_math_function(self.a + self.b)
return another_complicated_math_function(self.a * self.b ** 2)

@complicated_property.expression
def complicated_property(cls):
    return case(None, (cls.a.between(17, 173), fn.math(fn.more_math(cls.a, 
        1.23))), default=fn.another_complicated_math(cls.a))
Определение виртуальных полей в peewee