def get_h5file(file_path, mode='<STR_LIT:r>'):
if not op.exists(file_path):<EOL><INDENT>raise IOError('<STR_LIT>'.format(file_path))<EOL><DEDENT>try:<EOL><INDENT>h5file = h5py.File(file_path, mode=mode)<EOL><DEDENT>except:<EOL><INDENT>raise<EOL><DEDENT>else:<EOL><INDENT>return h5file<EOL><DEDENT>
Return the h5py.File given its file path.

    Parameters
    ----------
    file_path: string
        HDF5 file path

    mode: string
        r   Readonly, file must exist
        r+  Read/write, file must exist
        w   Create file, truncate if exists
        w-  Create file, fail if exists
        a   Read/write if exists, create otherwise (default)

    Returns
    -------
    h5file: h5py.File