import pathlib


def read_data_file(filepath, logger=None, msg_update_callback=None):
    """Retrieve file content from local disk as a string.

    :param str filepath: absolute filepath of the file, whose content we want
        to read.
    :param logging.Logger logger: optional logger to log with.
    :param utils.ConsoleMessagePrinter msg_update_callback: Callback
        object that writes messages onto console.

    :return: the contents of the file.

    :rtype: str

    :raises FileNotFoundError: if requested data file cannot be
        found.
    """
    path = pathlib.Path(filepath)
    if not path.is_file():
        msg = f"Requested data file at '{filepath}' not found"
        if msg_update_callback:
            msg_update_callback.error(msg)
        if logger:
            logger.error(msg, exc_info=True)
        raise FileNotFoundError(msg)

    msg = f"Found data file: {path}"
    if msg_update_callback:
        msg_update_callback.general(msg)
    if logger:
        logger.info(msg)
    return path.read_text()