<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 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}}