code: def rotation_matrix(angle, direction):
       
       d = numpy.array(direction, dtype=numpy.float64)
       d /= numpy.linalg.norm(d)
  
       eye = numpy.eye(3, dtype=numpy.float64)
       ddt = numpy.outer(d, d)
       skew = numpy.array([[    0,  d[2],  -d[1]],
                        [-d[2],     0,  d[0]],
                        [d[1], -d[0],    0]], dtype=numpy.float64)
  
       mtx = ddt + numpy.cos(angle) * (eye - ddt) + numpy.sin(angle) * skew
       
       M = numpy.eye(4)
       M[:3,:3] = mtx
       return M
docs: Create a rotation matrix corresponding to the rotation around a general
       axis by a specified angle.
  
       R = dd^T + cos(a) (I - dd^T) + sin(a) skew(d)
  
       Parameters:
  
           angle : float a
           direction : array d