code: def subtract_days(date_string, ndays):
      r"""Subtract a number of days from a given date.
  
      Parameters
      ----------
      date_string : str
          An alphanumeric string in the format %Y-%m-%d.
      ndays : int
          Number of days to subtract.
  
      Returns
      -------
      new_date_string : str
          The adjusted date string in the format %Y-%m-%d.
  
      Examples
      --------
  
      >>> subtract_days('2017-11-10', 31)   # '2017-10-10'
  
      """
      new_date_string = None
      valid = valid_date(date_string)
      if valid:
          date_dt = datetime.strptime(date_string, "%Y-%m-%d")
          new_date = date_dt - timedelta(days=ndays)
          new_date_string = new_date.strftime("%Y-%m-%d")
      return new_date_string
  
file_path: AlphaPy/alphapy/utilities.py
imports: from alphapy.globals import PSEP, SSEP, USEP
  import argparse
  from datetime import datetime, timedelta
  import glob
  import inspect
  from itertools import groupby
  import logging
  import numpy
  import os
  from os import listdir
  from os.path import isfile, join
  import re
label_desc: Use image node_id 5 for calling a global function with example usage: subtract_days(date_string, ndays) and returns: new_date_string