def METHOD_NAME(
    protocol_source: ProtocolSource,
    labware_definitions: Iterable[LabwareDefinition],
    python_parse_mode: PythonParseMode,
) -> LegacyProtocol:
    """Read a PAPIv2 protocol into a data structure."""
    protocol_file_path = protocol_source.main_file
    protocol_contents = protocol_file_path.read_text(encoding="utf-8")
    legacy_labware_definitions: Dict[str, LegacyLabwareDefinition] = {
        uri_from_details(
            namespace=lw.namespace,
            load_name=lw.parameters.loadName,
            version=lw.version,
        ): cast(LegacyLabwareDefinition, lw.dict(exclude_none=True))
        for lw in labware_definitions
    }
    data_file_paths = [
        data_file.path
        for data_file in protocol_source.files
        if data_file.role == ProtocolFileRole.DATA
    ]
    return parse(
        protocol_file=protocol_contents,
        filename=protocol_file_path.name,
        extra_labware=legacy_labware_definitions,
        extra_data={
            data_path.name: data_path.read_bytes() for data_path in data_file_paths
        },
        python_parse_mode=python_parse_mode,
    )