def load(self, chunk_size=None):
        if self.file:
            return

        if self.mode == 'r':
            self.file = tempfile.TemporaryFile()
            swift = _get_swift_client()

            try:
                _, contents = swift.get_object(self.get_directory(),
                                               self.get_name(), chunk_size)
                if chunk_size:
                    for c in contents:
                        self.file.write(c)
                else:
                    self.file.write(contents)
                self.file.flush()
                self.file.seek(0)
            except swift_exc.ClientException as e:
                if e.http_status == 404:
                    msg = "File '%s' does not exist." % self.path
                    raise exceptions.InvalidFilePathError(msg)
                else:
                    raise exceptions.FileSystemAccessError()
dataset/ETHPy150Open openstack/python-rackclient/rackclient/lib/syscall/default/file.py/File.load/original