<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def do_studies(ocean_backend, enrich_backend, studies_args, retention_time=None):
 """Execute studies related to a given enrich backend. If `retention_time` is not None, the study data is deleted based on the number of minutes declared in `retention_time`. :param ocean_backend: backend to access raw items :param enrich_backend: backend to access enriched items :param retention_time: maximum number of minutes wrt the current date to retain the data :param studies_args: list of studies to be executed """

    for study in enrich_backend.studies:
        selected_studies = [(s['name'], s['params']) for s in studies_args if s['type'] == study.__name__]

        for (name, params) in selected_studies:
            logger.info("Starting study: %s, params %s", name, str(params))
            try:
                study(ocean_backend, enrich_backend, **params)
            except Exception as e:
                logger.error("Problem executing study %s, %s", name, str(e))
                raise e

            # identify studies which creates other indexes. If the study is onion,
            # it can be ignored since the index is recreated every week
            if name.startswith('enrich_onion'):
                continue

            index_params = [p for p in params if 'out_index' in p]

            for ip in index_params:
                index_name = params[ip]
                elastic = get_elastic(enrich_backend.elastic_url, index_name)

                elastic.delete_items(retention_time)