'Cast TIME values (hour/min/sec) from input (to datetime.datetime).
Casts TIME input values formulated as ISO string or time tuple inputs.
Args:
values: either a single string with ISO time representation or 1-4
integer valued time tuple (hour), (hour, minute),
(hour, minute, second), (hour, minute, second, microsec).
Returns:
datetime.datetime value parsed from the input values.'

def __CastTime(self, values):

    if (len(values) == 1):
        value = self.__EncodeIfNeeded(values[0])
        if isinstance(value, str):
            try:
                time_tuple = time.strptime(value, '%H:%M:%S')
            except ValueError as err:
                self.__CastError('TIME', values, err)
            time_tuple = ((1970, 1, 1) + time_tuple[3:])
            time_tuple = time_tuple[0:6]
        elif isinstance(value, int):
            time_tuple = (1970, 1, 1, value)
        else:
            self.__CastError('TIME', values, 'Single    input    value    not    a    string    or    integer    hour')
    elif (len(values) <= 4):
        time_tuple = ((1970, 1, 1) + tuple(values))
    else:
        self.__CastError('TIME', values, 'function    takes    1    to    4    integers    or    1    string')
    try:
        return datetime.datetime(*time_tuple)
    except ValueError as err:
        self.__CastError('TIME', values, err)
