def build_kwargs_write(spec: dict, ext: str) -> dict:
    """Builds up kwargs for the Pandas to_* functions."""
    col_arg_names = {'.parquet': 'partition_cols',
                     '.xls': 'columns',
                     '.xlsx': 'columns',
                     '.csv': 'columns'}
    kwargs = {}

    if 'columns' in list(spec['output'].keys()) and not ext == '.parquet':
        kwargs[col_arg_names[ext]] = list(spec['output']['columns'].keys())

    return kwargs