def handle_output(results, output_type, action):
    """Print the relevant output for given output_type"""
    if output_type == 'QUIET':
        return

    if not output_type == 'JSON':
        if action == 'list':
            table = generate_list_table_result(
                logger, results, output_type == 'TABLE-NO-HEADER')
        else:
            table = generate_table_results(results, output_type == 'TABLE-NO-HEADER')
        if table:
            print(table)
    else:
        try:
            json_str = json.dumps(results)
            if json_str:
                print(json_str)
        except TypeError:
            logger.debug('Output is not JSON serializable, and then cannot '
                         'be printed with --output=JSON parameter.')
def handle_output ( results , output_type , action ) : if output_type == 'QUIET' : return if not output_type == 'JSON' : if action == 'list' : table = generate_list_table_result ( logger , results , output_type == 'TABLE-NO-HEADER' ) else : table = generate_table_results ( results , output_type == 'TABLE-NO-HEADER' ) if table : print ( table ) else : try : json_str = json . dumps ( results ) if json_str : print ( json_str ) except TypeError : logger . debug ( 'Output is not JSON serializable, and then cannot ' 'be printed with --output=JSON parameter.' )
Print the relevant output for given output_type