def _format_df(df, df_format):
    """Utility function for stringifying the dataframe based on desired format."""
    if df_format == 'table':
        return str(df.to_string())
    elif df_format == 'records':
        return str(df.to_dict(orient='records'))
    else:
        raise ValueError("Unknown df_format {}. Should be 'table' or 'records'"
            .format(df_format))
