def METHOD_NAME(client, resource_group_name, registry_name, dry_run=False):
    pipelineruns = client.pipeline_runs.list(resource_group_name=resource_group_name, registry_name=registry_name)
    failed_pipelineruns = list(filter(lambda x: (x.provisioning_state == 'Failed'), pipelineruns))
    num_failed_pipelineruns = len(failed_pipelineruns)
    logger.warning('Found %s failed pipeline-runs to delete.', num_failed_pipelineruns)
    if dry_run:
        logger.warning('The following failed pipeline-runs would have been deleted:')
        return failed_pipelineruns
    succ_count = 0
    failed_count = 0
    for pipelinerun in failed_pipelineruns:
        try:
            client.pipeline_runs.begin_delete(resource_group_name=resource_group_name,
                                              registry_name=registry_name,
                                              pipeline_run_name=pipelinerun.name)
            succ_count += 1
        except (ClientRequestError, AzureConnectionError, AzureResponseError, AzureInternalError, ResourceNotFoundError):
            failed_count += 1
        if succ_count % 100 == 0:
            logger.warning('Deletion in progress: Deleted %s/%s failed pipeline-runs. %s deletions failed.', succ_count, num_failed_pipelineruns, failed_count)
    logger.warning('Deletion complete: Deleted %s failed pipeline-runs.', succ_count)
    logger.warning('%s deletions failed.', failed_count)
    return None