block.expansion is defined as a class attribute (for example here 138), which is just an integer number indicating the expansion in the number of feature-maps through a convolution layer.
There is a convolution layer (see this line 64) where the number of input feature maps are planes and the number of output feature maps are planes * expansion.
The if-statement indicates if this layer needs downsample or not. And this is determined by two conditions:

whether stride is 1 or not
whether the current number of input feature-maps (self.inplanes) is equal to the planes * block.expansion or not.

The first condition is obvious that he it is related to downsampling. The second case corresponds to when the number of input features maps and output feature maps are not equal.