Build a new marker without the `extra == ...` part.

    The implementation relies very deep into packaging's internals, but I don't
    have a better way now (except implementing the whole thing myself).

    This could return `None` if the `extra == ...` part is the only one in the
    input marker.

def get_without_extra(marker):
    """Build a new marker without the `extra == ...` part.

    The implementation relies very deep into packaging's internals, but I don't
    have a better way now (except implementing the whole thing myself).

    This could return `None` if the `extra == ...` part is the only one in the
    input marker.
    """
    # TODO: Why is this very deep in the internals? Why is a better solution
    # implementing it yourself when someone is already maintaining a codebase
    # for this? It's literally a grammar implementation that is required to
    # meet the demands of a pep... -d
    if not marker:
        return None
    marker = Marker(str(marker))
    elements = marker._markers
    _strip_extra(elements)
    if elements:
        return marker
    return None