Implement a function that performs Xavier/Glorot weight initialization for a neural network layer. The function should support both uniform and normal distribution variants.
Given the number of input units (fan_in) and output units (fan_out) of a layer, along with a mode specifying the distribution type, generate a weight matrix with proper Xavier/Glorot scaling.
For the uniform variant, weights should be drawn from a uniform distribution bounded by a value derived from fan_in and fan_out. For the normal variant, weights should be drawn from a zero-mean Gaussian with a standard deviation derived from fan_in and fan_out.
Your function should:
Raise a ValueError if mode is not 'uniform' or 'normal'.