Parses a :ref:`constraint_expression <constraint-expressions>` \
        and returns a :class:`Constraint` object.

        :param constraint_expression: A \
        :ref:`constraint expression <constraint-expressions>`
        :type constraint_expression: str
        :raises: :exc:`InvalidConstraintExpression` when parsing fails.
        :rtype: :class:`Constraint`

def parse(cls, constraint_expression):
        """Parses a :ref:`constraint_expression <constraint-expressions>` \
        and returns a :class:`Constraint` object.

        :param constraint_expression: A \
        :ref:`constraint expression <constraint-expressions>`
        :type constraint_expression: str
        :raises: :exc:`InvalidConstraintExpression` when parsing fails.
        :rtype: :class:`Constraint`
        """
        match = RE.match(constraint_expression)

        if match:
            operator_str, version_str = match.groups()
            operator = Operator.parse(operator_str)
            version = Version.parse(version_str)
            return cls(operator, version)

        else:
            raise InvalidConstraintExpression(constraint_expression)