<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def validate(self, instance, value):
 """Check if value is a string, and strips it and changes case"""

        value_type = type(value)
        if not isinstance(value, string_types):
            self.error(instance, value)
        if self.regex is not None and self.regex.search(value) is None:        #pylint: disable=no-member
            self.error(instance, value, extra='Regex does not match.')
        value = value.strip(self.strip)
        if self.change_case == 'upper':
            value = value.upper()
        elif self.change_case == 'lower':
            value = value.lower()
        if self.unicode:
            value = text_type(value)
        else:
            value = value_type(value)
        return value