def format_output(instances, flag):
    """return formatted string per instance"""
    out = []
    line_format = '{0}\t{1}\t{2}\t{3}'
    name_len = _get_max_name_len(instances) + 3
    if flag:
        line_format = '{0:<' + str(name_len+5) + '}{1:<16}{2:<65}{3:<16}'

    for i in instances:
        endpoint = "{0}:{1}".format(i['Endpoint']['Address'], i['Endpoint']['Port'])
        out.append(
            line_format.format(i['DBInstanceIdentifier'], i['DBInstanceStatus'], endpoint, i['Engine']))
    return out
def format_output ( instances , flag ) : out = [ ] line_format = '{0}\t{1}\t{2}\t{3}' name_len = _get_max_name_len ( instances ) + 3 if flag : line_format = '{0:<' + str ( name_len + 5 ) + '}{1:<16}{2:<65}{3:<16}' for i in instances : endpoint = "{0}:{1}" . format ( i [ 'Endpoint' ] [ 'Address' ] , i [ 'Endpoint' ] [ 'Port' ] ) out . append ( line_format . format ( i [ 'DBInstanceIdentifier' ] , i [ 'DBInstanceStatus' ] , endpoint , i [ 'Engine' ] ) ) return out
return formatted string per instance