<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def query(self, **kwargs):
 """ Query the data source, subselecting data. Available keyword arguments include - model - scenario - region - variable Example ------- ``` Connection.query(model='MESSAGE', scenario='SSP2*', variable=['Emissions|CO2', 'Primary Energy']) ``` """

        headers = {
            'Authorization': 'Bearer {}'.format(self.auth()),
            'Content-Type': 'application/json',
        }
        data = json.dumps(self._query_post_data(**kwargs))
        url = self.base_url + 'runs/bulk/ts'
        r = requests.post(url, headers=headers, data=data)
        # refactor returned json object to be castable to an IamDataFrame
        df = (
            pd.read_json(r.content, orient='records')
            .drop(columns='runId')
            .rename(columns={'time': 'subannual'})
        )
        # check if returned dataframe has subannual disaggregation, drop if not
        if pd.Series([i in [-1, 'year'] for i in df.subannual]).all():
            df.drop(columns='subannual', inplace=True)
        # check if there are multiple version for any model/scenario
        lst = (
            df[META_IDX + ['version']].drop_duplicates()
            .groupby(META_IDX).count().version
        )
        if max(lst) > 1:
            raise ValueError('multiple versions for {}'.format(
                lst[lst > 1].index.to_list()))
        df.drop(columns='version', inplace=True)

        return df