<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def clean_pipelines(app='', settings=None):
 """Delete Pipelines for regions not defined in application.json files. For Pipelines named **app_name [region]**, _region_ will need to appear in at least one application.json file. All other names are assumed unamanaged. Args: app (str):
 Application name settings (dict):
 imported configuration settings Returns: True: Upon successful completion. Raises: SpinnakerPipelineCreationFailed: Missing application.json file from `create-configs`. """

    pipelines = get_all_pipelines(app=app)
    envs = settings['pipeline']['env']

    LOG.debug('Find Regions in: %s', envs)

    regions = set()
    for env in envs:
        try:
            regions.update(settings[env]['regions'])
        except KeyError:
            error_msg = 'Missing "{}/application-master-{}.json".'.format(RUNWAY_BASE_PATH, env)
            raise SpinnakerPipelineCreationFailed(error_msg)
    LOG.debug('Regions defined: %s', regions)

    for pipeline in pipelines:
        pipeline_name = pipeline['name']

        try:
            region = check_managed_pipeline(name=pipeline_name, app_name=app)
        except ValueError:
            LOG.info('"%s" is not managed.', pipeline_name)
            continue

        LOG.debug('Check "%s" in defined Regions.', region)

        if region not in regions:
            delete_pipeline(app=app, pipeline_name=pipeline_name)

    return True