code: def datetime_delta_to_ms(delta):
      
      delta_ms = delta.days * 24 * 60 * 60 * 1000
      delta_ms += delta.seconds * 1000
      delta_ms += delta.microseconds / 1000
      delta_ms = int(delta_ms)
      return delta_ms
docs: Given a datetime.timedelta object, return the delta in milliseconds