code: def dotilt(dec, inc, bed_az, bed_dip):
      
      rad = old_div(np.pi, 180.)  # converts from degrees to radians
      X = dir2cart([dec, inc, 1.])  # get cartesian coordinates of dec,inc
  # get some sines and cosines of new coordinate system
      sa, ca = -np.sin(bed_az * rad), np.cos(bed_az * rad)
      cdp, sdp = np.cos(bed_dip * rad), np.sin(bed_dip * rad)
  # do the rotation
      xc = X[0] * (sa * sa + ca * ca * cdp) + X[1] * \
          (ca * sa * (1. - cdp)) + X[2] * sdp * ca
      yc = X[0] * ca * sa * (1. - cdp) + X[1] * \
          (ca * ca + sa * sa * cdp) - X[2] * sa * sdp
      zc = X[0] * ca * sdp - X[1] * sdp * sa - X[2] * cdp
  # convert back to direction:
      Dir = cart2dir([xc, yc, -zc])
      # return declination, inclination of rotated direction
      return Dir[0], Dir[1]
docs: Does a tilt correction on a direction (dec,inc) using bedding dip direction
      and bedding dip.
  
      Parameters
      ----------
      dec : declination directions in degrees
      inc : inclination direction in degrees
      bed_az : bedding dip direction
      bed_dip : bedding dip
  
      Returns
      -------
      dec,inc : a tuple of rotated dec, inc values
  
      Examples
      -------
      >>> pmag.dotilt(91.2,43.1,90.0,20.0)
      (90.952568837153436, 23.103411670066617)