Convert string to enum value.

def from_string(self, value):
        """Convert string to enum value."""
        if not isinstance(value, basestring):
            raise ValueError('expected string value: ' + str(type(value)))
        self.test_value(value)
        return value