def _format_stages_summary(stage_results):
    """
    stage_results (list of (tuples of 
        (success:boolean, stage_name:string, status_msg:string)))
    returns a string of a report, one line per stage.
    Something like:
        Stage: <stage x>  :: SUCCESS
        Stage: <stage y>  :: FAILED
        Stage: <stage z>  :: SUCCESS
    """
    #find the longest stage name to pad report lines
    max_name_len = 0
    for entry in stage_results:
        x, stage_name, y = entry
        name_len = len(stage_name)
        if name_len > max_name_len:
            max_name_len = name_len

    summary = ""
    for entry in stage_results:
        x, stage_name, status_msg = entry
        summary += 'Stage: ' + stage_name.ljust(max_name_len) + ":: " 
        summary += status_msg + '\n'
    
    return summary