def sorting_dates(start, advertised_start, announcement):
 try:
  start = dateutil.parser.parse(advertised_start)
  if (start.tzinfo is None):
   start = start.replace(tzinfo=utc)
 except (ValueError, AttributeError):
  start = start
 now = datetime.now(utc)
 return (announcement, start, now)

def sorting_dates ( start , advertised_start , announcement ) : try : start = dateutil . parser . parse ( advertised_start ) if ( start . tzinfo is None ) : start = start . replace ( tzinfo = utc ) except ( ValueError , AttributeError ) : start = start now = datetime . now ( utc ) return ( announcement , start , now )
utility function to get datetime objects for dates used to compute the is_new flag and the sorting_score .