+ if hasattr(x, 'list') and hasattr(x, 'to_vector'):
+ # This avoids calling to_vector() on a matrix algebra with
+ # e.g. quaternions where the returned vector is of the wrong
+ # length (three instead of four) because the quaternions don't
+ # know how many generators they have.
+ return _all2list(x.list())
+