def __getitem__(self, index):
        # TODO: clarify variable names and their units
        # units: bytes
        current_run_start_offset = 0

        if index < 0:
            index = len(self) + index

        # units: clusters
        for cluster_offset, num_clusters in self._runentries:
            # units: bytes
            run_length = num_clusters * self._clusters.get_cluster_size()

            if current_run_start_offset <= index < current_run_start_offset + run_length:
                # units: bytes
                i = index - current_run_start_offset
                cluster = self._clusters[cluster_offset]
                return cluster[i]

            current_run_start_offset += run_length
        raise IndexError("%d is greater than the non resident attribute data length %s" %
            (index, len(self)))
dataset/ETHPy150Open williballenthin/python-ntfs/ntfs/filesystem/__init__.py/NonResidentAttributeData.__getitem__/original