from typing import Dict
from typing import Any


def make_keydict(key_to_type: Dict[str, Any]) -> str:
    """
    Returns the python code for declaring a dictionary that
    changes the returned strings to their correct types

    Parameters
    ----------
    key_to_type: dict
        keys are the field names in the returned structure, values
        are the functions to call to cast to correct type

    Returns
    -------
    keydict_declare: str
        String to paste into stub function to create the desired dictionary
    """
    accum = "{"

    for key, val in key_to_type.items():
        # no need to cast str to str
        if val != "str":
            accum += f"'{key}':{val},\n"

    accum += "}"
    return f"keydict : Dict[str,Any] = {accum}"