Cleans and returns the given value, or raises a ParameterNotValidError exception

def clean(self, value):
        """Cleans and returns the given value, or raises a ParameterNotValidError exception"""

        if not isinstance(value, (list, tuple, set, GeneratorType)):
            value = [value]

        gen = (self.param_type.clean(x) for x in value)

        if isinstance(value, GeneratorType):
            return gen
        else:
            return list(gen)