def hours(self):
        """
        Return the number of hours this entry has lasted. If the duration is a tuple with a start and an end time,
        the difference between the two times will be calculated. If the duration is a number, it will be returned
        as-is.
        """
        if not isinstance(self.duration, tuple):
            return self.duration

        if self.duration[1] is None:
            return 0

        time_start = self.get_start_time()

        # This can happen if the previous entry has a non-tuple duration
        # and the current entry has a tuple duration without a start time
        if time_start is None:
            return 0

        now = datetime.datetime.now()
        time_start = now.replace(
            hour=time_start.hour,
            minute=time_start.minute, second=0
        )
        time_end = now.replace(
            hour=self.duration[1].hour,
            minute=self.duration[1].minute, second=0
        )
        total_time = time_end - time_start
        total_hours = total_time.seconds / 3600.0

        return total_hours
Return the number of hours this entry has lasted. If the duration is a tuple with a start and an end time,
        the difference between the two times will be calculated. If the duration is a number, it will be returned
        as-is.