The parties may agree in writing or the court may direct that disclosure or inspection or both may take place in stages.