Parses a :ref:`requirement_expression <requirement-expressions>`
        into a :class:`Requirement` object.

        :param requirement_expression: A package requirement expression.
        :type requirement_expression: \
        :ref:`requirement_expression <requirement-expressions>`
        :rtype: :class:`Requirement`

def parse(cls, requirement_expression):
        """Parses a :ref:`requirement_expression <requirement-expressions>`
        into a :class:`Requirement` object.

        :param requirement_expression: A package requirement expression.
        :type requirement_expression: \
        :ref:`requirement_expression <requirement-expressions>`
        :rtype: :class:`Requirement`

        """
        match = RE.match(requirement_expression)

        if match:
            name, build_metadata, version_constraints_str = match.groups()

            if version_constraints_str:
                version_constraints = \
                    Constraints.parse(version_constraints_str)
            else:
                version_constraints = None

            if build_metadata:
                build_options = \
                    set(o.strip() for o in build_metadata.split(','))
            else:
                build_options = None

            return cls(name, version_constraints, build_options)

        else:
            raise InvalidRequirementExpression(requirement_expression)