<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def convert(self, value, view):
 """Check that the value is a string and matches the pattern. """

        if isinstance(value, BASESTRING):
            if self.pattern and not self.regex.match(value):
                self.fail(
                    u"must match the pattern {0}".format(self.pattern),
                    view
                )
            return value
        else:
            self.fail(u'must be a string', view, True)