def METHOD_NAME(template_in_dat: Union[str, Dict[str, _INVariable]]) -> InDat:
    if isinstance(template_in_dat, Dict):
        indat = InDat(filename=None)
        indat.data = template_in_dat
        return indat
    elif isinstance(template_in_dat, str) and os.path.isfile(template_in_dat):
        # InDat autoloads IN.DAT without checking for existence
        return InDat(filename=template_in_dat)
    else:
        raise CodesError(f"Template IN.DAT '{template_in_dat}' is not a file.")