def METHOD_NAME(self, shift):
    if not shift:
        return 0
    time_formats = ['%Y-%m-%d %H:%M:%S',
                    '%Y-%m-%d %H:%M',
                    '%H:%M:%S',
                    '%H:%M']
    for time_format in time_formats:
        try:
            date = datetime.datetime.strptime(shift, time_format)
        except ValueError:
            continue
        except TypeError:
            self.log.warning('Start time must be string type ("%s"), ignored "%s"', time_format[0], shift)
            break
        today = datetime.date.today()
        if today > date.date():
            date = datetime.datetime(today.year, today.month, today.day, date.hour, date.minute, date.second)
        return time.mktime(date.timetuple()) - self.start_time
    else:
        self.log.warning('Unrecognized time format: %s ("%s" required), ignored', shift, time_formats[0])
    return 0