code: def reader(self, fp, encoding):
          
          _, suffix = os.path.splitext(fp.name)
          if suffix == '.gz':
              fp.close()
              return gzip.open(fp.name)
          elif suffix == '.json':
              return json.load(fp)
          elif suffix == '.csv' or self.delimiter:
              return csvreader(fp, encoding, delimiter=self.delimiter or ',')
          elif suffix == '.tsv':
              return csvreader(fp, encoding, delimiter='\t')
          return fp
docs: Simple `open` wrapper for several file types.
          This supports ``.gz`` and ``.json``.
  
          :param fp: opened file
          :type fp: file pointer
          :param encoding: encoding of opened file
          :type encoding: string
          :rtype: file pointer