# Path: terminaltables/width_and_alignment.py
# def visible_width(string):
#     """Get the visible width of a unicode string.
# 
#     Some CJK unicode characters are more than one byte unlike ASCII and latin unicode characters.
# 
#     From: https://github.com/Robpol86/terminaltables/pull/9
# 
#     :param str string: String to measure.
# 
#     :return: String's width.
#     :rtype: int
#     """
#     if '\033' in string:
#         string = RE_COLOR_ANSI.sub('', string)
# 
#     # Convert to unicode.
#     try:
#         string = string.decode('u8')
#     except (AttributeError, UnicodeEncodeError):
#         pass
# 
#     width = 0
#     for char in string:
#         if unicodedata.east_asian_width(char) in ('F', 'W'):
#             width += 2
#         else:
#             width += 1
# 
#     return width


from terminaltables.width_and_alignment import visible_width
        yield right


def build_border(outer_widths, horizontal, left, intersect, right, title=None):
    """Build the top/bottom/middle row. Optionally embed the table title within the border.

    Title is hidden if it doesn't fit between the left/right characters/edges.

    Example return value:
    ('<', '-----', '+', '------', '+', '-------', '>')
    ('<', 'My Table', '----', '+', '------->')

    :param iter outer_widths: List of widths (with padding) for each column.
    :param str horizontal: Character to stretch across each column.
    :param str left: Left border.
    :param str intersect: Column separator.
    :param str right: Right border.
    :param title: Overlay the title on the border between the left and right characters.

    :return: Returns a generator of strings representing a border.
    :rtype: iter
    """
    length = 0

    # Hide title if it doesn't fit.
    if title is not None and outer_widths:
        try:
            length = visible_width(title)
        except TypeError:
            title = str(title)

# Path: terminaltables/width_and_alignment.py
# def visible_width(string):
#     """Get the visible width of a unicode string.
# 
#     Some CJK unicode characters are more than one byte unlike ASCII and latin unicode characters.
# 
#     From: https://github.com/Robpol86/terminaltables/pull/9
# 
#     :param str string: String to measure.
# 
#     :return: String's width.
#     :rtype: int
#     """
#     if '\033' in string:
#         string = RE_COLOR_ANSI.sub('', string)
# 
#     # Convert to unicode.
#     try:
#         string = string.decode('u8')
#     except (AttributeError, UnicodeEncodeError):
#         pass
# 
#     width = 0
#     for char in string:
#         if unicodedata.east_asian_width(char) in ('F', 'W'):
#             width += 2
#         else:
#             width += 1
# 
#     return width


# Path: terminaltables/build.py
from terminaltables.width_and_alignment import visible_width

        yield right


def build_border(outer_widths, horizontal, left, intersect, right, title=None):
    """Build the top/bottom/middle row. Optionally embed the table title within the border.

    Title is hidden if it doesn't fit between the left/right characters/edges.

    Example return value:
    ('<', '-----', '+', '------', '+', '-------', '>')
    ('<', 'My Table', '----', '+', '------->')

    :param iter outer_widths: List of widths (with padding) for each column.
    :param str horizontal: Character to stretch across each column.
    :param str left: Left border.
    :param str intersect: Column separator.
    :param str right: Right border.
    :param title: Overlay the title on the border between the left and right characters.

    :return: Returns a generator of strings representing a border.
    :rtype: iter
    """
    length = 0

    # Hide title if it doesn't fit.
    if title is not None and outer_widths:
        try:
            length = visible_width(title)
        except TypeError:
            title = str(title)

            length = visible_width(title)