<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def get_constituents(self, index_ticker, date=None, only_list=False):
 """ Get a list of all constituents of a given index. index_ticker - Datastream ticker for index date - date for which list should be retrieved (if None then list of present constituents is retrieved) only_list - request only list of symbols. By default the method retrieves many extra fields with information (various mnemonics and codes). This might pose some problems for large indices like Russel-3000. If only_list=True, then only the list of symbols and names are retrieved. """

        if date is not None:
            str_date = pd.to_datetime(date).strftime('%m%y')
        else:
            str_date = ''
        # Note: ~XREF is equal to the following large request
        # ~REP~=DSCD,EXMNEM,GEOG,GEOGC,IBTKR,INDC,INDG,INDM,INDX,INDXEG,INDXFS,INDXL,
        #       INDXS,ISIN,ISINID,LOC,MNEM,NAME,SECD,TYPE
        fields = '~REP~=NAME' if only_list else '~XREF'
        query = 'L' + index_ticker + str_date + fields
        raw = self.request(query)

        res, metadata = self.parse_record_static(raw)
        return res