def datetime_f(dttm):
 if dttm:
  dttm = dttm.isoformat()
  now_iso = datetime.now().isoformat()
  if (now_iso[:10] == dttm[:10]):
   dttm = dttm[11:]
  elif (now_iso[:4] == dttm[:4]):
   dttm = dttm[5:]
 return u'<nobr>{}</nobr>'.format(dttm)

def datetime_f ( dttm ) : if dttm : dttm = dttm . isoformat ( ) now_iso = datetime . now ( ) . isoformat ( ) if ( now_iso [ : 10 ] == dttm [ : 10 ] ) : dttm = dttm [ 11 : ] elif ( now_iso [ : 4 ] == dttm [ : 4 ] ) : dttm = dttm [ 5 : ] return u'<nobr>{}</nobr>' . format ( dttm )
formats datetime to take less room when it is recent .