def write_stage(self, request):
            # add stage to local datastore and syncs with shelve
	    user_name = "mpenhall"
	    stagetype = 0
	    if request.get("type") == "work":
	        stagetype = 1
	    newstage = StageObj(
	        parent = ndb.Key("User","mpenhall"),
	        starttime= datetime.fromtimestamp(int(request.get('startTimeStamp'))/1000.0),
	        interval = int(request.get('interval'))/60,
	        worktype = bool(stagetype),
	        uuid = str(uuid.uuid4()),
	        stopped = False)
	    newstage.put()
	    return "{'status':'sucess'}"
	def get_stages(self, limit, start=0):
            # provides list of stages history
	    user_name = "mpenhall"
	    ancestor_key = ndb.Key("User", user_name or "*nouser*")
	    return StageObj.query_user(ancestor_key).fetch(limit)