<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def find_by(self, **kwargs):
 """ Find first record subject to restrictions in +kwargs+, raising RecordNotFound if no such record exists. """

        result = self.where(**kwargs).first()
        if result:
            return result
        else:
            raise RecordNotFound(kwargs)