def get(self, file_path):
        file_path = file_path.split("?")[0]
        file_path = join(self.path, file_path)

        # check that the path is under the responses directory
        if relpath(file_path, self.path)[:2] == pardir:
            self.set_status(400)
            self.finish('File path must be under the responses directory')

        try:
            f = open(file_path, 'r')
            file_contents = f.read()

            if hasattr(self.request, "connection"):
                self.request.connection.stream.set_close_callback(None)
            if len(file_contents) > 0:
                self.request.write(file_contents)
            self.request.finish()

            f.close()
            return

        except IOError:
            self.set_status(404)
            self.finish('File Not Found: %s' % file_path)


# pylint: enable=R0904,W0221,E1101
dataset/ETHPy150Open turbulenz/turbulenz_local/turbulenz_local/lib/responsefromfile.py/ResponseFromFileHandler.get/original