<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _datetime_key_for_merge(self, logevent):
 """Helper method for ordering log lines correctly during merge."""

        if not logevent:
            # if logfile end is reached, return max datetime to never
            # pick this line
            return datetime(MAXYEAR, 12, 31, 23, 59, 59, 999999, tzutc())

        # if no datetime present (line doesn't have one) return mindate
        # to pick this line immediately
        return logevent.datetime or datetime(MINYEAR, 1, 1, 0, 0, 0, 0,
                                             tzutc())