def METHOD_NAME(
    spdx2_external_ref: ExternalPackageRef,
) -> Optional[Union[ExternalReference, ExternalIdentifier]]:
    reference_type = spdx2_external_ref.reference_type
    locator = spdx2_external_ref.locator
    comment = spdx2_external_ref.comment
    if reference_type not in external_ref_type_map:
        print_missing_conversion(
            reference_type,
            0,
            f"Conversion of ExternalPackageRef of type {reference_type} is currently not supported."
            f"https://github.com/spdx/spdx-3-model/issues/81",
        )
        return None
    id_or_ref_type = external_ref_type_map[reference_type]
    if isinstance(id_or_ref_type, ExternalReferenceType):
        return ExternalReference(id_or_ref_type, [locator], None, comment)
    elif isinstance(id_or_ref_type, ExternalIdentifierType):
        return ExternalIdentifier(id_or_ref_type, locator, comment)