<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def in_chain(cls, client, chain_id, expiration_dates=[]):
 """ fetch all option instruments in an options chain - expiration_dates = optionally scope """


        request_url = "https://api.robinhood.com/options/instruments/"
        params = {
            "chain_id": chain_id,
            "expiration_dates": ",".join(expiration_dates)
        }

        data = client.get(request_url, params=params)
        results = data['results']

        while data['next']:
            data = client.get(data['next'])
            results.extend(data['results'])
        return results