def _flatten_results_with_err(results_with_err):
    """flatten results with error

    Args:
        results_with_err ([(Error, result)]): results with error

    Returns:
        (Error, [result]): error, results
    """
    err_msg_list = []
    results = []
    for idx, (each_err, each_result) in enumerate(results_with_err):
        if each_err:
            err_msg_list.append('(%s/%s) e: %s' % (idx, len(results_with_err), each_err))
        results.append(each_result)

    err = None if not err_msg_list else Exception(','.join(err_msg_list))
    if err:
        return err, results

    return None, results