def datetimeformat(dt, fmt=None, relative=False):
 fmt = (fmt or '%b %d, %Y %I:%M %p')
 if relative:
  time_difference = _relative_timestamp(dt)
  if time_difference:
   return '{} ago'.format(time_difference)
 return dt.strftime(fmt)

def datetimeformat ( dt , fmt = None , relative = False ) : fmt = ( fmt or '%b %d, %Y %I:%M %p' ) if relative : time_difference = _relative_timestamp ( dt ) if time_difference : return '{} ago' . format ( time_difference ) return dt . strftime ( fmt )
returns date/time formatted using babels locale settings .