def download(self, config):
        path = config.path
        sheet_id = config.id
        sheet_gid = config.gid
        service = self._create_service()
        resp = service.files().get(fileId=sheet_id).execute()
        ext = os.path.splitext(self.config.path)[1]
        convert_to = None
        if ext == '.json':
            convert_to = ext
            ext = '.csv'
        elif ['.yaml', '.yml'] in ext:
            convert_to = ext
            ext = '.csv'
        for mimetype, url in resp['exportLinks'].iteritems():
            if not mimetype.endswith(ext[1:]):
                continue
            if self.config.gid:
                url += '&gid={}'.format(self.config.gid)
            resp, content = service._http.request(url)
            if resp.status != 200:
                self.logger.error('Error {} downloading Google Sheet: {}'.format(resp.status, path))
                break
            if convert_to in ['.json', '.yaml', '.yml']:
                fp = cStringIO.StringIO()
                fp.write(content)
                fp.seek(0)
                reader = csv.DictReader(fp)
                kwargs = {}
                if convert_to == '.json':
                    if self.config.output_style == 'pretty':
                        kwargs['indent'] = 2
                        kwargs['separators'] = (',', ': ')
                        kwargs['sort_keys'] = True
                    content = json.dumps([row for row in reader], **kwargs)
                else:
                    content = yaml.safe_dump(
                        list(reader),
                        default_flow_style=False)
            self.pod.write_file(path, content)
            self.logger.info('Downloaded Google Sheet -> {}'.format(path))
dataset/ETHPy150Open grow/grow/grow/preprocessors/google_drive.py/GoogleSheetsPreprocessor.download/swapped operands of `in`