def kv_parse(encoded_text):
    """Decodes a kv encoded (see function above) string to a dictionary object"""
    output = {}
    attributes = encoded_text.split('&')

    # Add each attribute to the dictionary, converting it to int if it is a digit
    for attribute in attributes:
        values = attribute.split('=')
        key = int(values[0]) if values[0].isdigit() else values[0]
        value = int(values[1]) if values[1].isdigit() else values[1]
        output[key] = value

    return output