Convert a val schema dictionary to teleport.

def _dict_to_teleport(dict_value):
    """Convert a val schema dictionary to teleport."""
    if len(dict_value) == 1:
        for key, value in dict_value.items():
            if key is str:
                return {"Map": from_val(value)}

    optional = {}
    required = {}
    for key, value in dict_value.items():
        if isinstance(key, Optional):
            optional[key.value] = from_val(value)
        else:
            required[key] = from_val(value)

    return {"Struct": {
        "required": required,
        "optional": optional}}