def _cmidrule(colindex, dataset_width):
    """Generates the `cmidrule` for a single column with appropriate trimming
    based on the column position.

    :param colindex: Column index
    :param dataset_width: width of the dataset
    """

    rule = '\\cmidrule(%s){%d-%d}'
    if colindex == 1:
        # Rule of first column is trimmed on the right
        return rule % ('r', colindex, colindex)
    if colindex == dataset_width:
        # Rule of last column is trimmed on the left
        return rule % ('l', colindex, colindex)
    # Inner columns are trimmed on the left and right
    return rule % ('lr', colindex, colindex)
dataset/ETHPy150Open kennethreitz/tablib/tablib/formats/_latex.py/_cmidrule/original