code: def date2timestamp(dte):
      '''Convert a *dte* into a valid unix timestamp.'''
      seconds = mktime(dte.timetuple())
      if isinstance(dte, datetime):
          return seconds + dte.microsecond / 1000000.0
      else:
          return int(secondsf date2timestamp(dte):
      '''Convert a *dte* into a valid unix timestamp.'''
      seconds = mktime(dte.timetuple())
      if isinstance(dte, datetime):
          return seconds + dte.microsecond / 1000000.0
      else:
          return int(seconds)
docs: Convert a *dte* into a valid unix timestamp.