def region_builder(data):
    """
    Takes an instance of a ping result and builds a dictionary ready to
    display.

    The ping result returns the raw results. This function returns a dictionary
    with all the sections formatted.

    :param data: dic Result of ping call.
    :return dic Result of the ping ready to display.
    """
    if len(data) == 1:
        return {'index': -1, 'region': data[0].ljust(4), 'average': '',
                'maximum': '', 'color': '| color=#444'}

    index = float(data[1])
    region_initials = '{region}:'.format(region=data[0].ljust(4))
    average = '{average} {unit}'.format(average=data[1], unit=data[3])
    maximum = '(max {maximum} {unit})'.format(maximum=data[2], unit=data[3])

    if index < 100:
        color = '|color=#0A640C'  # Green
    elif index < 150:
        color = '|color=#FEC041'  # Yellow
    else:
        color = '|color=#FC645F'  # Red

    return {'index': index, 'region': region_initials, 'average': average,
            'maximum': maximum, 'color': color}