code: def strip_extras_markers_from_requirement(req):
      # type: (TRequirement) -> TRequirement
      
      if req is None:
          raise TypeError("Must pass in a valid requirement, received {0!r}".format(req))
      if getattr(req, "marker", None) is not None:
          marker = req.marker  # type: TMarker
          marker._markers = _strip_extras_markers(marker._markers)
          if not marker._markers:
              req.marker = None
          else:
              req.marker = marker
      return req
docs: Given a :class:`~packaging.requirements.Requirement` instance with markers defining
      *extra == 'name'*, strip out the extras from the markers and return the cleaned
      requirement
  
      :param PackagingRequirement req: A packaging requirement to clean
      :return: A cleaned requirement
      :rtype: PackagingRequirement