def inner_join(left_rows, left_column_id, right_rows, right_column_id, header=True):
    len_left_headers = len(left_rows[0])

    if header:
        output = [left_rows[0] + right_rows[0]]
        left_rows = left_rows[1:]
        right_rows = right_rows[1:]
    else:
        output = []

    # Map right rows to keys
    right_mapped_keys = _get_mapped_keys(right_rows, right_column_id)

    for left_row in left_rows:
        len_left_row = len(left_row)

        if len_left_row < len_left_headers:
            left_row.extend([None] * (len_left_headers - len_left_row))

        left_key = left_row[left_column_id]

        if left_key in right_mapped_keys:
            for right_row in right_mapped_keys[left_key]:
                output.append(left_row + right_row)

    return output
Execute an inner join on two tables and return the combined table.
dataset/ETHPy150Open wireservice/csvkit/csvkit/join.py/inner_join