def _place_ship(self, game, user, ship_type, start_position, end_position): try: ship = Ship(parent=game.key) ship.place_ship(game, user, ship_type, start_position, end_position) ship.put() game.put() except ValueError as e: raise endpoints.BadRequestException(e) return game.to_form('Ship placed!')