code: def __NormalizeStartEnd(self, start, end=None):
          
          if end is not None:
              if start < 0:
                  raise exceptions.TransferInvalidError(
                      'Cannot have end index with negative start index ' +
                      '[start=%d, end=%d]' % (start, end))
              elif start >= self.total_size:
                  raise exceptions.TransferInvalidError(
                      'Cannot have start index greater than total size ' +
                      '[start=%d, total_size=%d]' % (start, self.total_size))
              end = min(end, self.total_size - 1)
              if end < start:
                  raise exceptions.TransferInvalidError(
                      'Range requested with end[%s] < start[%s]' % (end, start))
              return start, end
          else:
              if start < 0:
                  start = max(0, start + self.total_size)
              return start, self.total_size - 1
docs: Normalizes start and end values based on total size.