def dictionary_to_kv(d: dict) -> str:
    """
    Given a dictionary, encode it in key value format.

    :param d: The dictionary to be encoded.
    :return: The encoded key-value version of the dictionary.
    """
    assert d
    return "&".join(
        "=".join((str(k), str(v))) for k, v in d.items()
    )