def METHOD_NAME(header, align):
    headers = HEADER_SPLIT.split(header)
    aligns = ALIGN_SPLIT.split(align)
    if header.endswith('|'):
        headers.append('')
    cells = []
    for i, v in enumerate(aligns):
        if re.search(r'^ *-+: *$', v):
            aligns[i] = 'right'
        elif re.search(r'^ *:-+: *$', v):
            aligns[i] = 'center'
        elif re.search(r'^ *:-+ *$', v):
            aligns[i] = 'left'
        else:
            aligns[i] = None
        if len(headers) > i:
            cells.append({
                'type': 'table_cell',
                'text': headers[i],
                'params': (aligns[i], True)
            })
    i += 1
    while i + 1 < len(headers):
        cells.append({
            'type': 'table_cell',
            'text': headers[i],
            'params': (None, True)
        })
        aligns.append(None)
        i += 1
    thead = {'type': 'table_head', 'children': cells}
    return thead, aligns