human
Complete the below
def decode_message(message_type, encoded_message):

    ''''Merge JSON structure to Message instance.
    Args:
    message_type: Message to decode data to.
    encoded_message: JSON encoded version of message.
    Returns:
    Decoded instance of message_type.
    Raises:
    ValueError: If encoded_message is not valid JSON.
    messages.ValidationError if merged message is not initialized.'
    '''

Give me a the Python program you requested?
assistant
#Here is the Python program you requested.
    if (not encoded_message.strip()):
        return message_type()
    dictionary = json.loads(encoded_message)
    def find_variant(value):
        "Find    the    messages.Variant    type    that    describes    this    value.\n\n                Args:\n                        value:    The    value    whose    variant    type    is    being    determined.\n\n                Returns:\n                        The    messages.Variant    value    that    best    describes    value's    type,    or    None    if\n                        it's    a    type    we    don't    know    how    to    handle.\n                "
        if isinstance(value, (int, long)):
            return messages.Variant.INT64
        elif isinstance(value, float):
            return messages.Variant.DOUBLE
        elif isinstance(value, basestring):
            return messages.Variant.STRING
        elif isinstance(value, (list, tuple)):
            variant_priority = [None, messages.Variant.INT64, messages.Variant.DOUBLE, messages.Variant.STRING]
            chosen_priority = 0
            for v in value:
                variant = find_variant(v)
                try:
                    priority = variant_priority.index(variant)
                except IndexError:
                    priority = (-1)
                if (priority > chosen_priority):
                    chosen_priority = priority
            return variant_priority[chosen_priority]
        return None
    def decode_dictionary(message_type, dictionary):
        'Merge    dictionary    in    to    message.\n\n                Args:\n                        message:    Message    to    merge    dictionary    in    to.\n                        dictionary:    Dictionary    to    extract    information    from.        Dictionary\n                                is    as    parsed    from    JSON.        Nested    objects    will    also    be    dictionaries.\n                '
        message = message_type()
        for (key, value) in dictionary.iteritems():
            if...