class NodeID implements Externalizable {
    private static List<NodeID> instances = new ArrayList<>();

    private byte[] nodeID;

    public static synchronized NodeID getInstance(byte[] nodeIdBytes) {<FILL_FUNCTION_BODY>}

    public static synchronized void deleteInstance(byte[] nodeIdBytes) {
        NodeID toDelete = null;
        for (NodeID nodeID : instances) {
            if (nodeID.equals(nodeIdBytes)) {
                toDelete = nodeID;
                break;
            }
        }
        if (toDelete != null) {
            instances.remove(toDelete);
        }
    }

    public NodeID() {
    }

    private NodeID(byte[] nodeIdBytes) {
        this.nodeID = nodeIdBytes;
    }

    public boolean equals(byte[] anotherID) {
        return Arrays.equals(nodeID, anotherID);
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        NodeID that = (NodeID) o;

        return Arrays.equals(nodeID, that.nodeID);
    }

    @Override
    public int hashCode() {
        return Arrays.hashCode(nodeID);
    }
    
    @Override
    public String toString() {
        return new String(nodeID, StandardCharsets.UTF_8);
    }

    public byte[] toByteArray() {
        return nodeID;
    }

    @Override
    public void writeExternal(ObjectOutput out) throws IOException {
        ExternalizableUtil.getInstance().writeByteArray(out, nodeID);
    }

    @Override
    public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
        nodeID = ExternalizableUtil.getInstance().readByteArray(in);
    }
}

        for (NodeID nodeID : instances) {
            if (nodeID.equals(nodeIdBytes)) {
                return nodeID;
            }
        }
        NodeID answer = new NodeID(nodeIdBytes);
        instances.add(answer);
        return answer;
    
<no_super_class>