'Cast input values to Key() class using encoded string or tuple list.'

def __CastKey(self, values):

    if (not (len(values) % 2)):
        return datastore_types.Key.from_path(_app=self.__app, namespace=self.__namespace, *values)
    elif ((len(values) == 1) and isinstance(values[0], basestring)):
        return datastore_types.Key(values[0])
    else:
        self.__CastError('KEY', values, 'requires    an    even    number    of    operands    or    a    single    encoded    string')
