code: def create_CD(orient, scale, cx=None, cy=None):
      
      cxymat = np.array([[cx[1],cx[0]],[cy[1],cy[0]]])
      rotmat = fileutil.buildRotMatrix(orient)*scale/3600.
      new_cd = np.dot(rotmat,cxymat)
      return new_cd
docs: Create a (un?)distorted CD matrix from the basic inputs.
  
      The 'cx' and 'cy' parameters, if given, provide the X and Y coefficients of
      the distortion as returned by reading the IDCTAB.  Only the first 2 elements
      are used and should correspond to the 'OC[X/Y]10' and 'OC[X/Y]11' terms in that
      order as read from the expanded SIP headers.
  
      The units of 'scale' should be 'arcseconds/pixel' of the reference pixel.
      The value of 'orient' should be the absolute orientation on the sky of the
      reference pixel.