<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def get_stage_for_epoch(self, epoch_start, window_length=None, attr='stage'):
 """Return stage for one specific epoch. Parameters id_epoch : str index of the epoch attr : str, optional 'stage' or 'quality' Returns ------- stage : str description of the stage. """

        for epoch in self.epochs:
            if epoch['start'] == epoch_start:
                return epoch[attr]

            if window_length is not None:
                epoch_length = epoch['end'] - epoch['start']
                if logical_and(window_length < epoch_length,
                               0 <= \
                               (epoch_start - epoch['start']) < epoch_length):
                    return epoch[attr]