def pread(self, position, length):
_complain_ifclosed(self.closed)<EOL>if position > self.size:<EOL><INDENT>raise IOError("<STR_LIT>")<EOL><DEDENT>if length < <NUM_LIT:0>:<EOL><INDENT>length = self.size - position<EOL><DEDENT>data = self.f.raw.pread(position, length)<EOL>if self.__encoding:<EOL><INDENT>return data.decode(self.__encoding, self.__errors)<EOL><DEDENT>else:<EOL><INDENT>return data<EOL><DEDENT>
r"""
        Read ``length`` bytes of data from the file, starting from
        ``position``\ .

        :type position: int
        :param position: position from which to read
        :type length: int
        :param length: the number of bytes to read
        :rtype: string
        :return: the chunk of data read from the file