code: def rotate(self, vector):
          
          if isinstance(vector, Quaternion):
              return self._rotate_quaternion(vector)
          q = Quaternion(vector=vector)
          a = self._rotate_quaternion(q).vector
          if isinstance(vector, list):
              l = [x for x in a]
              return l
          elif isinstance(vector, tuple):
              l = [x for x in a]
              return tuple(l)
          else:
              return a
docs: Rotate a 3D vector by the rotation stored in the Quaternion object.
  
          Params:
              vector: A 3-vector specified as any ordered sequence of 3 real numbers corresponding to x, y, and z values.
                  Some types that are recognised are: numpy arrays, lists and tuples.
                  A 3-vector can also be represented by a Quaternion object who's scalar part is 0 and vector part is the required 3-vector.
                  Thus it is possible to call `Quaternion.rotate(q)` with another quaternion object as an input.
  
          Returns:
              The rotated vector returned as the same type it was specified at input.
  
          Raises:
              TypeError: if any of the vector elements cannot be converted to a real number.
              ValueError: if `vector` cannot be interpreted as a 3-vector or a Quaternion object.