from typing import OrderedDict


def read_dat_file(dat_file):
    """ Read an ASCII ".dat" file from JXP format 'database'

    Parameters
    ----------
    dat_file : str
     filename

    Returns
    -------
    dat_dict : OrderedDict
      A dict containing the info in the .dat file
    """
    # Define
    datdict = OrderedDict()
    # Open
    f = open(dat_file, 'r')
    for line in f:
        tmp = line.split('! ')
        tkey = tmp[1].strip()
        key = tkey
        val = tmp[0].strip()
        datdict[key] = val
    f.close()

    return datdict