def delete_pyp(self, request):
     pyp = Pyp.get_by_id(request.id)
     if not pyp:
         raise endpoints.NotFoundException(
             "The policy or program ID: " + str(request.id) + " doesn't exist")
     pyp.key.delete()
     return message_types.VoidMessage()
 def get_pyp(self, request):
     pyp = Pyp.get_by_id(request.id)
     if not pyp:
         raise endpoints.NotFoundException(
             "The policy or program ID: " + str(request.id) + " doesn't exist")
     return PypListResponse(
         pyps=[PypApiHelper().to_message(pyp)])
 def update_pyp(self, request):
     pyp = Pyp.get_by_id(request.id)
     if not pyp:
         raise endpoints.NotFoundException(
             "The policy or program ID: " + str(request.id) + " doesn't exist")
     updated_pyp = Pyp.update(pyp, request)
     if not updated_pyp:
         raise endpoints.InternalServerErrorException('Something went wrong')
     return PypListResponse(
         pyps=[PypApiHelper().to_message(pyp)])