def _parse_dm_file(fn):
    """
    Parse DM file to extract axes properties, tags, image data, and
    binary.
    
    Parameters
    ----------
    fn : string
        DM file name.
        
    Returns
    -------  
    (pixX, axisX, unitsX) : tuple
        Image x-axis information where:
            pixX : int
                Number of pixels.
            axisX : ndarray
                Pixel axis.
            unitsX : string
                Axis units.
    (pixY, axisY, unitsY) : tuple
        y-axis information, as above.
    tag_dict : dictionary
        Dictionary of image tags.
    im_data : ndarray
        Image data array.
    bin_file : binary object
        Complete binary DM file.
    
    Examples
    --------
    xaxis, yaxis, tag_dict, im_data, bin_file = _parse_dm_file('1.dm3')
    pixX, axisX, unitsX = xaxis
    pixY, axisY, unitsY = yaxis
    
    """
    from hyperspy.io import load
    with open(fn, 'rb') as f:
        dm_bin = f.read()
    im = load(fn)
    dm_im = im.data
    tagd = im.original_metadata.as_dictionary()
    unitsX = im.axes_manager[0].units
    axisX = im.axes_manager[0].axis
    if len(im.axes_manager.shape) == 1:
        pixX = im.axes_manager.shape[0]
        pixY = 1
        unitsY = im.axes_manager[0].units
        axisY = 'y'
    else:
        pixX, pixY = im.axes_manager.shape
        unitsY = im.axes_manager[1].units
        axisY = im.axes_manager[1].axis
    return (pixX, axisX, unitsX), (pixY, axisY, unitsY), tagd, dm_im, dm_bin
