import sys, os
from datetime import datetime

def date_sort(obj, key, reverse=False):
  return sorted(
      obj,
      key=lambda item: datetime.strptime(item[key], '%Y-%m-%dT%H:%M:%S.%f'), 
      reverse=reverse
  )
