  The TIFR-ARIES Near Infrared Spectrometer (TANSPEC) instrument provides
simultaneous wavelength coverage from 0.55 to 2.5 micron, mounted on India's
largest ground-based telescope, 3.6-m Devasthal Optical Telescope at Nainital,
India. The TANSPEC offers three modes of observations, imaging with various
filters, spectroscopy in the low-resolution prism mode with derived R~ 100-400
and the high-resolution cross-dispersed mode (XD-mode) with derived median R~
2750 for a slit of width 0.5 arcsec. In the XD-mode, ten cross-dispersed orders
are packed in the 2048 x 2048 pixels detector to cover the full wavelength
regime. As the XD-mode is most utilized as well as for consistent data
reduction for all orders and to reduce data reduction time, a dedicated
pipeline is at the need. In this paper, we present the code for the TANSPEC
XD-mode data reduction, its workflow, input/output files, and a showcase of its
implementation on a particular dataset. This publicly available pipeline
pyTANSPEC is fully developed in Python and includes nominal human intervention
only for the quality assurance of the reduced data. Two customized
configuration files are used to guide the data reduction. The pipeline creates
a log file for all the fits files in a given data directory from its header,
identifies correct frames (science, continuum and calibration lamps) based on
the user input, and offers an option to the user for eyeballing and
accepting/removing of the frames, does the cleaning of raw science frames and
yields final wavelength calibrated spectra of all orders simultaneously.
