code: def return_dat(self, chan, begsam, endsam):
          
  
          if type(chan) == int:  # if single value is provided it needs to be transformed to list to generate a 2d matrix
              chan = [chan, ]
  
          if (begsam >= self._n_smp) or (endsam < 0):
              dat = empty((len(chan), endsam - begsam))
              dat.fill(NaN)
              return dat
  
          if begsam < 0:
              begpad = -1 * begsam
              begsam = 0
          else:
              begpad = 0
  
          if endsam > self._n_smp:
              endpad = endsam - self._n_smp
              endsam = self._n_smp
          else:
              endpad = 0
  
          dshape = (self._n_chan, endsam - begsam)
          sig_dtype = 'u' + str(self._n_bytes)
          offset = self._bodata + begsam * self._n_bytes * self._n_chan
          dat = memmap(str(self.filename), dtype=sig_dtype, order='F', mode='r',
                       shape=dshape, offset=offset).astype('float')
  
          dat = pad(dat[chan, :], ((0, 0), (begpad, endpad)), mode='constant',
                    constant_values=NaN)
  
          return (dat - self._offset[chan, None]) * self._factors[chan, None]
docs: Return the data as 2D numpy.ndarray.
  
          Parameters
          ----------
          chan : int or list
              index (indices) of the channels to read
          begsam : int
              index of the first sample
          endsam : int
              index of the last sample
  
          Returns
          -------
          numpy.ndarray
              A 2d matrix, with dimension chan X samples