<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def scan_sequence(self, frame, direction):
 """ Search in one reading frame """

        orf_start = None
        for c, index in self.codons(frame):
            if (c not in self.stop and (c in self.start or not self.start)
                and orf_start is None):
                orf_start = index
            elif c in self.stop and orf_start is not None:
                self._update_longest(orf_start, index + 3, direction, frame)
                orf_start = None

        if orf_start is not None:
            self._update_longest(orf_start, index + 3, direction, frame)