def file_path_to_dto(file_path):
    """Converts a `file_path` return value to a `FilePath` Swift DTO value.

    Args:
        file_path: A value returned from `file_path`.

    Returns:
        A `FilePath` Swift DTO value, which is either a string or a `struct`
        containing the following fields:

        *   `_`: The file path.
        *   `f`: `True` if the path is a folder.
        *   `t`: Maps to `FilePath.FileType`:
            *   "p" for `.project`
            *   "e" for `.external`
            *   "g" for `.generated`
            *   "i" for `.internal`
    """
    if not file_path:
        return None

    ret = {}

    if file_path.is_folder:
        ret["f"] = True

    if file_path.type != "p":
        ret["t"] = file_path.type

    if ret:
        ret["_"] = file_path.path

    # `FilePath` allows a `string` to imply a `.project` file
    return ret if ret else file_path.path