code: def transform_datetime_to_unix(dtime=None):
      
      if not dtime:
          dtime = datetime.now()
  
      if not isinstance(dtime, datetime):
          raise TypeError('dtime should be datetime, but we got {}'.format(type(dtime)))
  
      return time.mktime(dtime.timetuple())
docs: 将 datetime 类型转换成 unix 时间戳
  
      :param:
          * dtime: (datetime) datetime 类型实例,默认为当前时间
      :return:
          * data_type: (datetime) datetime 类型实例
  
      举例如下::
  
          print('--- transform_datetime_to_unix demo ---')
          dtime = datetime.datetime.now()
          ans_time = transform_datetime_to_unix(dtime)
          print(ans_time)
          print('---')
  
      执行结果::
  
          --- transform_datetime_to_unix demo ---
          1535108620.0
          ---