'Cast DATETIME values (string or tuple) from input (to datetime.datetime).
Casts DATETIME input values formulated as ISO string or datetime tuple
inputs.
Args:
values: either a single string with ISO representation or 3-7
integer valued time tuple (year, month, day, ...).
Returns:
datetime.datetime value parsed from the input values.'

def __CastDatetime(self, values):

    if (len(values) == 1):
        value = self.__EncodeIfNeeded(values[0])
        if isinstance(value, str):
            try:
                time_tuple = time.strptime(str(value), '%Y-%m-%d    %H:%M:%S')[0:6]
            except ValueError as err:
                self.__CastError('DATETIME', values, err)
        else:
            self.__CastError('DATETIME', values, 'Single    input    value    not    a    string')
    else:
        time_tuple = values
    try:
        return datetime.datetime(*time_tuple)
    except ValueError as err:
        self.__CastError('DATETIME', values, err)
