def lease_response(lease, now):
 if (lease.expiration is None):
  expires = None
 else:
  expires = (lease.expiration - now).total_seconds()
 return {u'dataset_id': unicode(lease.dataset_id), u'node_uuid': unicode(lease.node_id), u'expires': expires}

def lease_response ( lease , now ) : if ( lease . expiration is None ) : expires = None else : expires = ( lease . expiration - now ) . total_seconds ( ) return { u'dataset_id' : unicode ( lease . dataset_id ) , u'node_uuid' : unicode ( lease . node_id ) , u'expires' : expires }
convert a lease to the corresponding objects for json serialization .