def field_if_exists(settings, key: str, name: str) ->str:
    """
    Return value of nested fields if those are specified.

    Parameters
    ----------
    settings : typing.Dict
        YAML parsed to dict
    key : str
        Name of field to look for in type (either "output" or "result")
    name: str
        Name of field to look for in one of "output" or "result"

    Returns
    -------
    str:
        "" or value provided in field

    """
    if settings['return'][key] is None:
        return ''
    return settings['return'][key][name]
