This should probably go with all the other `expand_foo` functions rather than duplicate it here.