def levels_to_graph(levels):
    """
    Convert an array of levels into a unicode string graph.

    Each level in the levels array is an integer 0-3. Those levels will be
    represented in the graph by 1-4 dots each.

    The returned string will contain two levels per rune.
    """
    if len(levels) % 2 == 1:
        # Left pad uneven-length arrays with an empty column
        levels = [-1] + levels

    # From: http://stackoverflow.com/a/19177754/473672
    unicodify = chr
    try:
        # Python 2
        unicodify = unichr  # type: ignore
    except NameError:
        # Python 3
        pass

    # https://en.wikipedia.org/wiki/Braille_Patterns#Identifying.2C_naming_and_ordering
    LEFT_BAR = [0x00, 0x40, 0x44, 0x46, 0x47]
    RIGHT_BAR = [0x00, 0x80, 0xA0, 0xB0, 0xB8]

    graph = ""
    for index in range(0, len(levels) - 1, 2):
        left_level = levels[index] + 1
        right_level = levels[index + 1] + 1
        code = 0x2800 + LEFT_BAR[left_level] + RIGHT_BAR[right_level]
        graph += unicodify(code)

    return graph