def get_replica(request, pid):
    """MNReplication.getReplica(session, did) → OctetStream."""
    _assert_node_is_authorized(request, pid)
    sciobj = d1_gmn.app.models.ScienceObject.objects.get(pid__did=pid)
    content_type_str = d1_gmn.app.object_format_cache.get_content_type(
        sciobj.format.format
    )
    # Replica is always a local file that can be handled with FileResponse()
    response = django.http.FileResponse(
        d1_gmn.app.sciobj_store.open_sciobj_file_by_pid(pid), content_type_str
    )
    d1_gmn.app.views.headers.add_sciobj_properties_headers_to_response(response, sciobj)
    # Log the replication of this object.
    d1_gmn.app.event_log.log_replicate_event(pid, request)
    return response