Convert a value into a pattern matched string value.

        All string values are matched against a regex before they are
        considered acceptable values.

        Args:
            value (any): The value to coerce.

        Raises:
            ValueError: If the value is not an acceptable value.

        Returns:
            str: The pattern matched value represented.

def coerce(self, value):
        """Convert a value into a pattern matched string value.

        All string values are matched against a regex before they are
        considered acceptable values.

        Args:
            value (any): The value to coerce.

        Raises:
            ValueError: If the value is not an acceptable value.

        Returns:
            str: The pattern matched value represented.
        """
        if not isinstance(value, compat.basestring):

            value = str(value)

        if not self._re.match(value):

            raise ValueError(
                "The value {0} does not match the pattern {1}".format(
                    value,
                    self.pattern,
                )
            )

        return value