def clean(self, value):
if isinstance(value, numbers.Number):<EOL><INDENT>return value<EOL><DEDENT>elif isinstance(value, six.string_types):<EOL><INDENT>try:<EOL><INDENT>value = float(value)<EOL>return int(value) if value.is_integer() else value<EOL><DEDENT>except ValueError:<EOL><INDENT>raise ParameterNotValidError<EOL><DEDENT><DEDENT>raise ParameterNotValidError<EOL>
Cleans and returns the given value, or raises a ParameterNotValidError exception