If the element is none we simply do not pass it to the shift method. But none can't be shifted in the first place.
However, this is more of a bandaid than solving the underlying issue. I haven't been able to figure out why the element is None in the first place. Any insight into this Bernd?