def METHOD_NAME(file_path: Path) -> tuple[dict[str, Any], list[tuple[int, str]]] | tuple[None, None]:
    """Parse file to dict object"""
    template = None
    template_lines = None
    try:
        template, template_lines = loads(file_path=file_path)
    except IOError as e:
        if e.errno == 2:
            logger.error(f"Template file not found: {file_path}")
        elif e.errno == 21:
            logger.error(f"Template references a directory, not a file: {file_path}")
        elif e.errno == 13:
            logger.error(f"Permission denied when accessing template file: {file_path}")
    except UnicodeDecodeError:
        logger.error(f"Cannot read file contents: {file_path}")
    except ScannerError as err:
        if err.problem in ("found character '\\t' that cannot start any token", "found unknown escape character"):
            try:
                result = json_parse(file_path, allow_nulls=False)
                if result:
                    template, template_lines = result  # type:ignore[assignment]  # this is handled by the next line
                    if isinstance(template, list):
                        # should not happen and is more relevant for type safety
                        template = template[0]
            except Exception:
                logger.error(f"Template {file_path} is malformed: {err.problem}")
                logger.error(f"Tried to parse {file_path} as JSON", exc_info=True)
    except YAMLError:
        pass
    if template is None or template_lines is None:
        return None, None
    return template, template_lines