def get_last_doc(doctype):
 d = get_all(doctype, [u'name'], order_by=u'creation desc', limit_page_length=1)
 if d:
  return get_doc(doctype, d[0].name)
 else:
  raise DoesNotExistError

def get_last_doc ( doctype ) : d = get_all ( doctype , [ u'name' ] , order_by = u'creation desc' , limit_page_length = 1 ) if d : return get_doc ( doctype , d [ 0 ] . name ) else : raise DoesNotExistError
get last created document of this type .