<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def data2md(table):
 """ Creates a markdown table. The first row will be headers. Parameters table : list of lists of str A list of rows containing strings. If any of these strings consist of multiple lines, they will be converted to single line because markdown tables do not support multiline cells. Returns ------- str The markdown formatted string Example ------- | Species | Coolness | | Dog | Awesome | | Cat | Meh | """


    table = copy.deepcopy(table)

    table = ensure_table_strings(table)
    table = multis_2_mono(table)
    table = add_cushions(table)

    widths = []
    for column in range(len(table[0])):
        widths.append(get_column_width(column, table))

    output = '|'
    for i in range(len(table[0])):
        output = ''.join(
            [output, center_line(widths[i], table[0][i]), '|'])

    output = output + '\n|'
    for i in range(len(table[0])):
        output = ''.join([
            output, center_line(widths[i], "-" * widths[i]), '|'])
    output = output + '\n|'

    for row in range(1, len(table)):
        for column in range(len(table[row])):
            output = ''.join(
                [output, center_line(widths[column],
                 table[row][column]), '|'])
        output = output + '\n|'

    split = output.split('\n')
    split.pop()

    table_string = '\n'.join(split)

    return table_string